<?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: If Then Else Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793926#M641332</link>
    <description># ./BkupScript&lt;BR /&gt;IT WORKS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks all!</description>
    <pubDate>Tue, 31 May 2011 18:33:06 GMT</pubDate>
    <dc:creator>J.Kimbrell</dc:creator>
    <dc:date>2011-05-31T18:33:06Z</dc:date>
    <item>
      <title>If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793920#M641326</link>
      <description>Hello All,&lt;BR /&gt;I have a script that isn't working and being a noob at this, I need the help of experts.&lt;BR /&gt;Below is the script;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;MSGTXT="`omnistat |awk '{print $1,$2,$3}'"&lt;BR /&gt;echo $MSGTXT&lt;BR /&gt;        if [$MSGTXT="No currently running"]&lt;BR /&gt;        then&lt;BR /&gt;omnisv stop&lt;BR /&gt;sleep 30&lt;BR /&gt;cp -p /opt/omni/* /destination&lt;BR /&gt;cp -p /var/opt/omni/* /destination&lt;BR /&gt;cp -p /etc/opt/omni/* /destination&lt;BR /&gt;omnisv start&lt;BR /&gt;echo IT WORKS&lt;BR /&gt;        else&lt;BR /&gt;echo SESSION OPEN&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;J.</description>
      <pubDate>Tue, 31 May 2011 17:31:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793920#M641326</guid>
      <dc:creator>J.Kimbrell</dc:creator>
      <dc:date>2011-05-31T17:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793921#M641327</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;The second line is mangled.   You need matching back-ticks or better yet:&lt;BR /&gt;&lt;BR /&gt;MSGTXT=$(omnistat|awk '{print $1,$2,$3}')&lt;BR /&gt;&lt;BR /&gt;The notation '$( ... )' is modern POSIX syntax or the archaic back-ticks.  Both forms execute the enclosed command(s) and collect the output.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 31 May 2011 17:45:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793921#M641327</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-31T17:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793922#M641328</link>
      <description>Thank You Sir, So it should look like;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;MSGTXT=$(omnistat|awk '{print $1,$2,$3}')&lt;BR /&gt;:echo $MSGTXT&lt;BR /&gt;        if [$MSGTXT="No currently running"]&lt;BR /&gt;        then&lt;BR /&gt;omnisv stop&lt;BR /&gt;sleep 30&lt;BR /&gt;cp -p /opt/omni/* /destination&lt;BR /&gt;cp -p /var/opt/omni/* /destination&lt;BR /&gt;cp -p /etc/opt/omni/* /destination&lt;BR /&gt;omnisv start&lt;BR /&gt;echo IT WORKS&lt;BR /&gt;        else&lt;BR /&gt;echo SESSION OPEN&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Tue, 31 May 2011 17:52:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793922#M641328</guid>
      <dc:creator>J.Kimbrell</dc:creator>
      <dc:date>2011-05-31T17:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793923#M641329</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; So it should look like;&lt;BR /&gt;&lt;BR /&gt;Well, drop the colon before the word 'echo'.  You can do a half-decent syntax check with:&lt;BR /&gt;&lt;BR /&gt;# sh -n filename&lt;BR /&gt;&lt;BR /&gt;...where 'filename' is whatever you call your script.  If no output appears, then the script is syntactically correct as far as the shell can determine. &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF..</description>
      <pubDate>Tue, 31 May 2011 17:58:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793923#M641329</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-05-31T17:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793924#M641330</link>
      <description>One last thing as a Maybe-Just-In-Case.  Change the line&lt;BR /&gt;&lt;BR /&gt;if [$MSGTXT="No currently running"]&lt;BR /&gt;&lt;BR /&gt;to be&lt;BR /&gt;&lt;BR /&gt;if [ "$MSGTXT" = "No currently running" ]&lt;BR /&gt;&lt;BR /&gt;Close to a quarter-century of experience with HP's shells have taught me to be Very Very Careful when doing string comparisons, so I'm quite liberal with the use of double-quotes to delimit all character strings inside my scripts.</description>
      <pubDate>Tue, 31 May 2011 18:21:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793924#M641330</guid>
      <dc:creator>Michael Mike Reaser</dc:creator>
      <dc:date>2011-05-31T18:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793925#M641331</link>
      <description>Nice thanks, Don't know where the colon came from, but nontheless, it's not there.&lt;BR /&gt;I did the sh -n with no errors, however, I keep getting the "SESSION OPEN" even though there isn't any open.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;J.</description>
      <pubDate>Tue, 31 May 2011 18:25:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793925#M641331</guid>
      <dc:creator>J.Kimbrell</dc:creator>
      <dc:date>2011-05-31T18:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793926#M641332</link>
      <description># ./BkupScript&lt;BR /&gt;IT WORKS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks all!</description>
      <pubDate>Tue, 31 May 2011 18:33:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-help/m-p/4793926#M641332</guid>
      <dc:creator>J.Kimbrell</dc:creator>
      <dc:date>2011-05-31T18:33:06Z</dc:date>
    </item>
  </channel>
</rss>

