<?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: shell script question?? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122757#M804142</link>
    <description>Hi Penny:&lt;BR /&gt;&lt;BR /&gt;Could you repost the question?  Last post got some garbage in it.&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
    <pubDate>Tue, 18 Nov 2003 19:06:30 GMT</pubDate>
    <dc:creator>Michael Steele_2</dc:creator>
    <dc:date>2003-11-18T19:06:30Z</dc:date>
    <item>
      <title>shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122756#M804141</link>
      <description>isReachable () {&lt;BR /&gt;        commandlist="$@" ;&lt;BR /&gt;        status="noproblem"&lt;BR /&gt;        for command in $commandlist&lt;BR /&gt;        do&lt;BR /&gt;        echo "Testing $command"&lt;BR /&gt;        location=`which $command 2&amp;gt;/dev/null`&lt;BR /&gt;        echo $location&lt;BR /&gt;        if [ "x$location" = "x" ]; then&lt;BR /&gt;        echo&lt;BR /&gt;        echo "*** System command \"$command\" could not be found ! ***"&lt;BR /&gt;        echo&lt;BR /&gt;        status="error"&lt;BR /&gt;        fi&lt;BR /&gt;        done&lt;BR /&gt;        if [ "$status" = "error" ]; then&lt;BR /&gt;                return 1;&lt;BR /&gt;        else&lt;BR /&gt;                return 0;&lt;BR /&gt;        fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;##&lt;BR /&gt;# Get the OS&lt;BR /&gt;##&lt;BR /&gt;OS=`uname`&lt;BR /&gt;&lt;BR /&gt;##&lt;BR /&gt;# Check for the presence of system commands&lt;BR /&gt;##&lt;BR /&gt;if [ "$OS" = "SunOS" ]; then&lt;BR /&gt;        isReachable "unzip sameer /usr/ucb/ps showrev patchadd pkginfo grep find ls uname cat rm chmod ln bc hostname df&lt;BR /&gt; sed awk head cpio cut dc wc expr nawk uniq jar"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt; result=$?&lt;BR /&gt;&lt;BR /&gt;  if [ "$result" = "1" ]; then&lt;BR /&gt;  echo "The above listed missing command(s) are necessary.Please make sure that these commands are in the environment path."&lt;BR /&gt;  echo "    Exiting..."&lt;BR /&gt;&lt;BR /&gt;On Solaris the â  whichâ   command writes to standard output instead of standard error and therefore isReachable returns a 0 even when the command is not found.&lt;BR /&gt;&lt;BR /&gt;Can anybody please help me solve this problem?&lt;BR /&gt;Thanks in adv</description>
      <pubDate>Tue, 18 Nov 2003 18:29:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122756#M804141</guid>
      <dc:creator>Penny Patch</dc:creator>
      <dc:date>2003-11-18T18:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122757#M804142</link>
      <description>Hi Penny:&lt;BR /&gt;&lt;BR /&gt;Could you repost the question?  Last post got some garbage in it.&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Tue, 18 Nov 2003 19:06:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122757#M804142</guid>
      <dc:creator>Michael Steele_2</dc:creator>
      <dc:date>2003-11-18T19:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122758#M804143</link>
      <description>What does it write to the standard output if which fails?  Surely something like "File not found."  Can you not test for that instead of your $Status?&lt;BR /&gt;&lt;BR /&gt;if [ "$Location" = "File not found." ]; then&lt;BR /&gt;return 1;&lt;BR /&gt;else&lt;BR /&gt;return 0;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Does &lt;BR /&gt;whereis -b&lt;BR /&gt;give you a different output?&lt;BR /&gt;&lt;BR /&gt;Also my manual says you need to run this in csh so I would expect you might want to add &lt;BR /&gt;&lt;BR /&gt;#!/bin/csh&lt;BR /&gt;&lt;BR /&gt;as the first line.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ron&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Nov 2003 23:15:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122758#M804143</guid>
      <dc:creator>Ron Kinner</dc:creator>
      <dc:date>2003-11-18T23:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122759#M804144</link>
      <description>Penny, &lt;BR /&gt;   I think you need to check for the return code returned by isReachable function ,inside the if [ "$OS = "SunOS]; &lt;BR /&gt;So, your script looks like, &lt;BR /&gt;&lt;BR /&gt;if [ "$OS" = "SunOS" ]; then&lt;BR /&gt;isReachable "unzip sameer /usr/ucb/ps showrev patchadd pkginfo grep find ls uname cat rm chmod ln bc hostname df&lt;BR /&gt;sed awk head cpio cut dc wc expr nawk uniq jar"&lt;BR /&gt;&lt;BR /&gt;result=$?&lt;BR /&gt;&lt;BR /&gt;if [ "$result" = "1" ]; then&lt;BR /&gt;echo "The above listed missing command(s) are necessary.Please make sure that these commands are in the environment path."&lt;BR /&gt;echo " Exiting..."&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;-Madhu</description>
      <pubDate>Tue, 18 Nov 2003 23:55:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122759#M804144</guid>
      <dc:creator>Madhu Sudhan_1</dc:creator>
      <dc:date>2003-11-18T23:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122760#M804145</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;make these adjustments and it should run:&lt;BR /&gt;which $command &amp;gt; /tmp/check.$$ 2&amp;gt;&amp;amp;1&lt;BR /&gt;location=`grep -v "no ${command} in" /tmp/check.$$`&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Nov 2003 11:49:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122760#M804145</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-19T11:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: shell script question??</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122761#M804146</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;if the problem is solved, could you spare some points from the endless supply of points, HP has, for those, who could help you? ;-)&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael</description>
      <pubDate>Wed, 26 Nov 2003 10:59:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/shell-script-question/m-p/3122761#M804146</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-11-26T10:59:21Z</dc:date>
    </item>
  </channel>
</rss>

