<?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 shell script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032035#M910490</link>
    <description>Hi &lt;BR /&gt;&lt;BR /&gt;this command works from command line &lt;BR /&gt;&lt;BR /&gt;ps -ef|grep `ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;but I cannot run within shell script, when I run the shell script I got these errors&lt;BR /&gt;&lt;BR /&gt;grep: can't open 11632&lt;BR /&gt;grep: can't open 19916&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am using HP-UX 11.0, POSIX Shell&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Murat</description>
    <pubDate>Thu, 24 Jul 2003 07:12:28 GMT</pubDate>
    <dc:creator>Murat SULUHAN</dc:creator>
    <dc:date>2003-07-24T07:12:28Z</dc:date>
    <item>
      <title>shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032035#M910490</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;this command works from command line &lt;BR /&gt;&lt;BR /&gt;ps -ef|grep `ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;but I cannot run within shell script, when I run the shell script I got these errors&lt;BR /&gt;&lt;BR /&gt;grep: can't open 11632&lt;BR /&gt;grep: can't open 19916&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I am using HP-UX 11.0, POSIX Shell&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Murat</description>
      <pubDate>Thu, 24 Jul 2003 07:12:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032035#M910490</guid>
      <dc:creator>Murat SULUHAN</dc:creator>
      <dc:date>2003-07-24T07:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032036#M910491</link>
      <description>Try this and see if it works:&lt;BR /&gt;ps_num=`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'` &lt;BR /&gt;ps -ef|grep $ps_num</description>
      <pubDate>Thu, 24 Jul 2003 07:19:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032036#M910491</guid>
      <dc:creator>twang</dc:creator>
      <dc:date>2003-07-24T07:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032037#M910492</link>
      <description>Hi,&lt;BR /&gt;i don't think that it will work proerly also from command line.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;grep expect two argument, a search patterna and a file name.&lt;BR /&gt;&lt;BR /&gt;if &lt;BR /&gt;&lt;BR /&gt;`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;returns more than 1 string, the first will be used as a search pattern, and the second as the file name.&lt;BR /&gt;&lt;BR /&gt;To have it working (don't know if is what you want..)&lt;BR /&gt;&lt;BR /&gt;`ps -ex|grep -v grep|grep tahoe| awk '{print $1}'` &amp;gt; /tmp/tmp.$$&lt;BR /&gt;&lt;BR /&gt;ps -ef|grep -f /tmp/tmp.$$ &lt;BR /&gt;&lt;BR /&gt;rm /tmp/tmp.$$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   Massimo&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:19:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032037#M910492</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-24T07:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032038#M910493</link>
      <description>Hi,&lt;BR /&gt;sorry, i made a typo:&lt;BR /&gt;&lt;BR /&gt;ps -ex|grep -v grep|grep tahoe| awk '{print $1}' &amp;gt; /tmp/tmp.$$ &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;without the "`...`"&lt;BR /&gt;&lt;BR /&gt;  Massimo&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:21:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032038#M910493</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-24T07:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032039#M910494</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;re Twang&lt;BR /&gt;I solved this problem like your solution, but I want to know my error about shell scripting :))&lt;BR /&gt;&lt;BR /&gt;re Massimo &lt;BR /&gt;ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`  &lt;BR /&gt;&lt;BR /&gt;is works, I am sure, look below :)&lt;BR /&gt;&lt;BR /&gt;tahoe:/home/root#ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`&lt;BR /&gt;    root 11632 11618  0  Jul 17  ?        62:09 /opt/weblogic7/jdk131_08/bin/../bin/PA_RISC2.0/native_thread&lt;BR /&gt;tahoe:/home/root#&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanx for your responses&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Murat SULUHAN &lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:40:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032039#M910494</guid>
      <dc:creator>Murat SULUHAN</dc:creator>
      <dc:date>2003-07-24T07:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032040#M910495</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;re Twang&lt;BR /&gt;I solved this problem like your solution, but I want to know my error about shell scripting :))&lt;BR /&gt;&lt;BR /&gt;*************************&lt;BR /&gt;&lt;BR /&gt;re Massimo Bianchi&lt;BR /&gt;&lt;BR /&gt;ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`  &lt;BR /&gt;&lt;BR /&gt;is works, I am sure, look below&lt;BR /&gt;&lt;BR /&gt;tahoe:/home/root#ps -ef | grep `ps -ex | grep -v grep | grep tahoe| awk '{print $1}'`&lt;BR /&gt;    root 11632 11618  0  Jul 17  ?        62:09 /opt/weblogic7/jdk131_08/bin/../bin/PA_RISC2.0/native_thread&lt;BR /&gt;tahoe:/home/root#&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanx for your responses&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Murat SULUHAN &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:45:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032040#M910495</guid>
      <dc:creator>Murat SULUHAN</dc:creator>
      <dc:date>2003-07-24T07:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032041#M910496</link>
      <description>Hi,&lt;BR /&gt;it works because you have only one line matching.&lt;BR /&gt;&lt;BR /&gt;When you start the script in backgroung, there may be some other line of ps matching, this is my though.&lt;BR /&gt;&lt;BR /&gt;Try my solution, without the rm of the file.&lt;BR /&gt;&lt;BR /&gt;How many lines do you get there ?&lt;BR /&gt;&lt;BR /&gt;   Massimo&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:45:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032041#M910496</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-07-24T07:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032042#M910497</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;first of all I am so sorry for two same message,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I understand what do you mean, I modify the script like that &lt;BR /&gt;&lt;BR /&gt;ps -ef | grep `ps -ex | grep -v grep | grep weblogic7 | grep tahoe| awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;it works now&lt;BR /&gt;&lt;BR /&gt;Thank you so much&lt;BR /&gt;&lt;BR /&gt;Best Regards&lt;BR /&gt;Murat&lt;BR /&gt;&lt;BR /&gt;PS: We have two separate weblogic installation in the same server with lots of domains, I am developing general administration script &lt;BR /&gt;</description>
      <pubDate>Thu, 24 Jul 2003 07:56:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032042#M910497</guid>
      <dc:creator>Murat SULUHAN</dc:creator>
      <dc:date>2003-07-24T07:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032043#M910498</link>
      <description>As a general note about use of the obsolete grave accent form (as in echo `hostname`). This was replaced by $(...) many years ago and is always thye preferred way to represent stdout from a set of commands. $() also can be nested, something that is particularly difficult with ``&lt;BR /&gt;&lt;BR /&gt;Another simplification that you might use is to have ps do all your searching for you:&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -C native_thread | grep tahoe&lt;BR /&gt;&lt;BR /&gt;ps has a LONG list of features that are not available unless the UNIX95 variable is defined. Since UNIX95 can change the behavior of other processes and libraries, it is recommended never to export or permanently define the variable. Just add it in front of the command and it will exist only for the one command.&lt;BR /&gt;&lt;BR /&gt;The -C option will search for the exact process name, something that grep cannot do. For instance:&lt;BR /&gt;&lt;BR /&gt;ps -ef | grep sh&lt;BR /&gt;UNIX95= ps -fC sh&lt;BR /&gt;&lt;BR /&gt;The first form cathes unhasdaemon and other unrelated processes (such as those owned by user=bashir) while the second form looks at the basename of the process for an exact match (won't find ksh for instance).</description>
      <pubDate>Thu, 24 Jul 2003 10:18:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-help/m-p/3032043#M910498</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-07-24T10:18:20Z</dc:date>
    </item>
  </channel>
</rss>

