<?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 Statement Help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610137#M888082</link>
    <description>Hi Jeff:&lt;BR /&gt;&lt;BR /&gt;The '-o' is "or".  '-a' denotes "and".  Have a look at the man pages for 'test' ('man test').&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 08 Nov 2001 18:06:26 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2001-11-08T18:06:26Z</dc:date>
    <item>
      <title>If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610128#M888073</link>
      <description>This is probably a very simple question, but any help will be appreciated. Does anybody have an example of an if statement where the variable could be more than one value. &lt;BR /&gt;&lt;BR /&gt;Here is an example one value that works.  &lt;BR /&gt;******************************&lt;BR /&gt;NAME=$1&lt;BR /&gt;&lt;BR /&gt;if [ $NAME = "John" ] ; then&lt;BR /&gt;    echo $NAME&lt;BR /&gt;else&lt;BR /&gt;    exit 0&lt;BR /&gt;fi&lt;BR /&gt;****************************&lt;BR /&gt;&lt;BR /&gt;What i need to do is add another possible value in the if statement where $NAME could equal "John or "Jane".  &lt;BR /&gt;&lt;BR /&gt;I can't seem to get the syntax correct.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Jeff&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:45:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610128#M888073</guid>
      <dc:creator>Jeff Paciolla_1</dc:creator>
      <dc:date>2001-11-08T17:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610129#M888074</link>
      <description>Hi Jeff:&lt;BR /&gt;&lt;BR /&gt;How about this:&lt;BR /&gt;&lt;BR /&gt;if [ "$I" = jim -o "$I" = james ]&lt;BR /&gt;then&lt;BR /&gt;  echo "that's me!"&lt;BR /&gt;else&lt;BR /&gt;  echo "I am not me"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 08 Nov 2001 17:50:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610129#M888074</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-11-08T17:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610130#M888075</link>
      <description>#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;export NAME=$1&lt;BR /&gt;&lt;BR /&gt;if [ $NAME = "John" ] ; then&lt;BR /&gt; echo "John $NAME "&lt;BR /&gt;elif [ $NAME = "Jane" ] ; then&lt;BR /&gt; echo "Jane: $NAME"&lt;BR /&gt;exit 0&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;(man ksh / look for case if there is multiple options)&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Thu, 08 Nov 2001 17:56:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610130#M888075</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2001-11-08T17:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610131#M888076</link>
      <description>James - What does the -o do in the if statement?&lt;BR /&gt;Thanks&lt;BR /&gt;Jeff</description>
      <pubDate>Thu, 08 Nov 2001 17:56:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610131#M888076</guid>
      <dc:creator>Jeff Paciolla_1</dc:creator>
      <dc:date>2001-11-08T17:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610132#M888077</link>
      <description>Hiya,&lt;BR /&gt;&lt;BR /&gt;Try &lt;BR /&gt;&lt;BR /&gt;if [ "$NAME" = "John" || "$NAME" = "Jane"] ; then &lt;BR /&gt;echo $NAME &lt;BR /&gt;else &lt;BR /&gt;exit 0 &lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;I think &amp;amp;&amp;amp; is the AND....&lt;BR /&gt;&lt;BR /&gt;Note that the /sbin/init.d directory has loads of HP startup scripts that are a good start to look for syntax :-)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;James&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:56:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610132#M888077</guid>
      <dc:creator>James Beamish-White</dc:creator>
      <dc:date>2001-11-08T17:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610133#M888078</link>
      <description>Hi Jeff:&lt;BR /&gt;&lt;BR /&gt;if [ "${name}" = "John" -o "${name}" = "Jane" ]&lt;BR /&gt;then &lt;BR /&gt;  echo "Ok"&lt;BR /&gt;else&lt;BR /&gt;  echo "Bad"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Note the quotes around "${name}" - they protect you in case the variable is ever null;&lt;BR /&gt;&lt;BR /&gt;Here's a variant with numeric comparisons using and&lt;BR /&gt;&lt;BR /&gt;if [ ${a} -ge 1 -a ${a} -le 10 ]&lt;BR /&gt;then&lt;BR /&gt;  echo "${a} is in range"&lt;BR /&gt;else&lt;BR /&gt;  echo "${a} is out of range"&lt;BR /&gt;fi&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:58:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610133#M888078</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-11-08T17:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610134#M888079</link>
      <description>&lt;IF&gt;&lt;/IF&gt;What i need to do is add another possible value in the if statement where $NAME could equal "John or "Jane". &amp;gt;&lt;BR /&gt;&lt;BR /&gt;  use -o option for giving the OR choice.&lt;BR /&gt;[ $NAME = "John"  -o  $NAME = "Jane" ]&lt;BR /&gt;&lt;BR /&gt;everything else remaining the same.&lt;BR /&gt;&lt;BR /&gt;(you can do a man on ksh for other related&lt;BR /&gt;options)&lt;BR /&gt;&lt;BR /&gt;-raj&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Nov 2001 17:59:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610134#M888079</guid>
      <dc:creator>Roger Baptiste</dc:creator>
      <dc:date>2001-11-08T17:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610135#M888080</link>
      <description>This could work too ..&lt;BR /&gt;&lt;BR /&gt;[[ $NAME = John || $NAME = Jane ]] &amp;amp;&amp;amp; echo $NAME || exit&lt;BR /&gt;&lt;BR /&gt;A one-liner without the "if" and the "then"</description>
      <pubDate>Thu, 08 Nov 2001 18:02:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610135#M888080</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2001-11-08T18:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610136#M888081</link>
      <description>&amp;gt;What does the -o do in the if statement? &lt;BR /&gt;&lt;BR /&gt;-o stands For OR ... -a =&amp;gt; AND&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;&lt;BR /&gt;Victor</description>
      <pubDate>Thu, 08 Nov 2001 18:04:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610136#M888081</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2001-11-08T18:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610137#M888082</link>
      <description>Hi Jeff:&lt;BR /&gt;&lt;BR /&gt;The '-o' is "or".  '-a' denotes "and".  Have a look at the man pages for 'test' ('man test').&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 08 Nov 2001 18:06:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610137#M888082</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2001-11-08T18:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610138#M888083</link>
      <description>"man test"&lt;BR /&gt;&lt;BR /&gt;good advice</description>
      <pubDate>Fri, 23 Apr 2004 07:53:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610138#M888083</guid>
      <dc:creator>mike boswell_3</dc:creator>
      <dc:date>2004-04-23T07:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Else Statement Help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610139#M888084</link>
      <description>Mike .... the last comment before urs was in 2001 !!!!!!!&lt;BR /&gt;&lt;BR /&gt;kaps</description>
      <pubDate>Fri, 23 Apr 2004 08:12:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-else-statement-help/m-p/2610139#M888084</guid>
      <dc:creator>KapilRaj</dc:creator>
      <dc:date>2004-04-23T08:12:49Z</dc:date>
    </item>
  </channel>
</rss>

