<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How come my alias cannot work? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568343#M872552</link>
    <description>Specifying the variable UNIX95 tells ps to behave like XPG4 using which we can generate desired reports like&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -o "pcpu pid args" |sort -n&lt;BR /&gt;&lt;BR /&gt;which will print percentage cpu of the processes in the reversed sorted order.&lt;BR /&gt;&lt;BR /&gt;There are good explanations by Bill and other folks in this forum itself. You can try searching with UNIX95 search string.&lt;BR /&gt;&lt;BR /&gt;Checkout manpage for ps to find out various options that can be used with XPG4 implementation of ps.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;PS: Please assign some points to the explanations you think are helpful to you. That will encourage people to participate more in the discussions.</description>
    <pubDate>Wed, 22 Aug 2001 06:34:02 GMT</pubDate>
    <dc:creator>Sridhar Bhaskarla</dc:creator>
    <dc:date>2001-08-22T06:34:02Z</dc:date>
    <item>
      <title>How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568339#M872548</link>
      <description>I worte an alias command as below,&lt;BR /&gt;alias psg='ps -el|grep \!*|grep -v grep'&lt;BR /&gt;But when I run "alias swapper", it says&lt;BR /&gt;grep: can't open swapper&lt;BR /&gt;&lt;BR /&gt;But ps -ef|grep swapper can produce results as below,&lt;BR /&gt;# ps -ef|grep swapper&lt;BR /&gt;    root     0     0  0  Apr  3  ?         1:28 swapper&lt;BR /&gt;    root 26497 26069  2 11:51:42 ttyp3     0:00 grep swapper&lt;BR /&gt;&lt;BR /&gt;Anybody know what's the reason?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Aug 2001 02:48:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568339#M872548</guid>
      <dc:creator>Rashid Ali</dc:creator>
      <dc:date>2001-08-22T02:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568340#M872549</link>
      <description>The alias command is useful for holding a lot of frequently typed commands.  However, alias is not like a shell script where parameters after the name of the alias can be imbedded inside the alias (ie, the name of the desired process).&lt;BR /&gt;&lt;BR /&gt;However, there is a much better and more reliable alias to use:&lt;BR /&gt;&lt;BR /&gt;alias psg="UNIX95= /usr/bin/ps -C"&lt;BR /&gt;&lt;BR /&gt;Now type the command: psg swapper&lt;BR /&gt;or better yet: psg sh&lt;BR /&gt;&lt;BR /&gt;You will see that only the true basename of the command is located and the non-specific matching of grep is avoided.  The UNIX95 setting is documented in the ps man page.</description>
      <pubDate>Wed, 22 Aug 2001 03:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568340#M872549</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2001-08-22T03:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568341#M872550</link>
      <description>Hi Zhang,&lt;BR /&gt;&lt;BR /&gt;you could try something like this&lt;BR /&gt;&lt;BR /&gt;alias psg='"ps -el|grep -v grep |grep "&lt;BR /&gt;&lt;BR /&gt;once you source your .kshrc or your env file, you should be able to run&lt;BR /&gt;psg swapper&lt;BR /&gt;&lt;BR /&gt;If you want to grep case insensitive you could modify your alias to&lt;BR /&gt;alias psg="ps -el |grep -v grep |grep "&lt;BR /&gt;&lt;BR /&gt;Actually there is another easier way, if you are looking for a process with a known basename you could set up another alias&lt;BR /&gt;alias psf="UNIX95= ps -flC "&lt;BR /&gt;&lt;BR /&gt;now running "psf swapper" would give you the same output.&lt;BR /&gt;For more information about UNIX95 (look at the manpage for ps)&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh</description>
      <pubDate>Wed, 22 Aug 2001 03:15:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568341#M872550</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-08-22T03:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568342#M872551</link>
      <description>Yes, it sounds great.  But I am still wondering why I can't use grep \!* and when I can use it.  Because I see this example from a book "UNIX Hacks&amp;amp;Hints".  Does the following command work on other flavours of UNIX such as Solaris or AIX?&lt;BR /&gt;alias psg='ps -el|grep \!*|grep -v grep'&lt;BR /&gt;&lt;BR /&gt;Anybody knows how to interpret "grep \!*" and show me an example?&lt;BR /&gt;&lt;BR /&gt;One more puzzle, What does it mean by "UNIX95" in your command and how does it work?&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Aug 2001 05:29:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568342#M872551</guid>
      <dc:creator>Rashid Ali</dc:creator>
      <dc:date>2001-08-22T05:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568343#M872552</link>
      <description>Specifying the variable UNIX95 tells ps to behave like XPG4 using which we can generate desired reports like&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -o "pcpu pid args" |sort -n&lt;BR /&gt;&lt;BR /&gt;which will print percentage cpu of the processes in the reversed sorted order.&lt;BR /&gt;&lt;BR /&gt;There are good explanations by Bill and other folks in this forum itself. You can try searching with UNIX95 search string.&lt;BR /&gt;&lt;BR /&gt;Checkout manpage for ps to find out various options that can be used with XPG4 implementation of ps.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;PS: Please assign some points to the explanations you think are helpful to you. That will encourage people to participate more in the discussions.</description>
      <pubDate>Wed, 22 Aug 2001 06:34:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568343#M872552</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-08-22T06:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568344#M872553</link>
      <description>If you really want to use what you read in Unix hacks&amp;amp;hints you can do it. Only thing is there one missing grep in your alias. It should be&lt;BR /&gt;&lt;BR /&gt;alias psg='ps -ef |grep \!* |grep -v grep|grep'&lt;BR /&gt;&lt;BR /&gt;This is your command with an additional grep statement.&lt;BR /&gt;&lt;BR /&gt;Your earlier command would be parsed as&lt;BR /&gt;&lt;BR /&gt;ps -el|grep \!*|grep -v grep inetd&lt;BR /&gt;&lt;BR /&gt;and obviously would result with the error message cannot open inetd.&lt;BR /&gt;&lt;BR /&gt;And your grep \!* seems to get all the processes. When we specify \!, the shell will not try to match the files in the local directory.&lt;BR /&gt;&lt;BR /&gt;However, as suggested by Bill and Ramesh, it is better to use XPG4 version of ps.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Wed, 22 Aug 2001 06:49:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568344#M872553</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-08-22T06:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: How come my alias cannot work?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568345#M872554</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;alias arguments only work in csh, i.e. (note there is no = sign):&lt;BR /&gt;&lt;BR /&gt;# alias pgp 'ps -ef|grep \!*|grep -v grep'&lt;BR /&gt;# pgp swapper&lt;BR /&gt;    root     0     0  0  Jul  1  ?        135:39 swapper&lt;BR /&gt;&lt;BR /&gt;If you want to use arguments in ksh, you have to use shell functions, or fix your alias so that any argument you type works if it is tagged onto the end of the definition, i.e.&lt;BR /&gt;&lt;BR /&gt;alias pgp="ps -ef|grep -v grep | grep "&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin.&lt;BR /&gt;&lt;BR /&gt;btw, points assignments are a little overdue ;-)</description>
      <pubDate>Wed, 22 Aug 2001 07:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-come-my-alias-cannot-work/m-p/2568345#M872554</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-08-22T07:27:41Z</dc:date>
    </item>
  </channel>
</rss>

