<?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: trouble with &amp;quot;||&amp;quot; operand in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104111#M444716</link>
    <description>thanks all for the help and suggestions - Dennis gave the best solution for the korn shell!&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;print "Please enter a hdisk or vpath you would like to check and potentially remove: \c"&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;read ANS&lt;BR /&gt;&lt;BR /&gt;        if [[ $ANS = hdisk[0-9]* || $ANS = vpath[0-9]* ]] ; then&lt;BR /&gt;&lt;BR /&gt;                break&lt;BR /&gt;                print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;        else&lt;BR /&gt;&lt;BR /&gt;                print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;echo $ANS&lt;BR /&gt;</description>
    <pubDate>Thu, 17 Apr 2008 11:48:49 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2008-04-17T11:48:49Z</dc:date>
    <item>
      <title>trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104098#M444703</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I cant get my if statement to work and I believe it may be to do with the || in the script:&lt;BR /&gt;&lt;BR /&gt;print "Please enter a hdisk or vpath you would like to check and potentially remove: \c"&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;read ANS&lt;BR /&gt;&lt;BR /&gt;        if [[ $ANS != hdisk[0-9]* || $ANS != vpath[0-9]* ]] ; then&lt;BR /&gt;&lt;BR /&gt;                print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;        else&lt;BR /&gt;&lt;BR /&gt;                break&lt;BR /&gt;&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;what is wrong here?&lt;BR /&gt;&lt;BR /&gt;is it to do with [[ &lt;CODE&gt; ]] - should I be using [ &lt;CODE&gt;&lt;BR /&gt;many thanks&lt;BR /&gt;&lt;BR /&gt;Chris.&lt;/CODE&gt;&lt;/CODE&gt;</description>
      <pubDate>Thu, 17 Apr 2008 10:09:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104098#M444703</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-17T10:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104099#M444704</link>
      <description>if [[ $ANS != hdisk[0-9]* || $ANS != vpath[0-9]* ]] &lt;BR /&gt;&lt;BR /&gt;wouldn't it be&lt;BR /&gt;&lt;BR /&gt;if [[ $ANS != hdisk[0-9]* ] || [ $ANS != vpath[0-9]* ]]</description>
      <pubDate>Thu, 17 Apr 2008 10:15:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104099#M444704</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-04-17T10:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104100#M444705</link>
      <description>no that is not correct ...&lt;BR /&gt;&lt;BR /&gt;Please enter a hdisk or vpath you would like to check and potentially remove: ./check_disk.ksh[5]: 0403-057 Syntax error at line 12 : `]' is not expected.&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 10:27:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104100#M444705</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-17T10:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104101#M444706</link>
      <description>No man you have to use -a (And) or -o (OR) operator instad of "||"&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Piyush Mathiya&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 10:40:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104101#M444706</guid>
      <dc:creator>piyush mathiya</dc:creator>
      <dc:date>2008-04-17T10:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104102#M444707</link>
      <description>&lt;!--!*#--&gt;You have the wrong operator.  You need:&lt;BR /&gt;if [[ $ANS != hdisk[0-9]* &amp;amp;&amp;amp; $ANS != vpath[0-9]* ]]; then&lt;BR /&gt;&lt;BR /&gt;Yours will always be true.&lt;BR /&gt;You may want to reverse your condition so it is more obvious:&lt;BR /&gt;if [[ $ANS = hdisk[0-9]* || $ANS = vpath[0-9]* ]] ; then&lt;BR /&gt;   break&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Note your pattern matching will match hdisk, followed by 0 .. 9, followed by anything.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Piyush: you have to use -a (And) or -o (OR) operator instead of "||"&lt;BR /&gt;&lt;BR /&gt;No, [[ ]] supports &amp;amp;&amp;amp; and ||.  [] only supports -a and -o.</description>
      <pubDate>Thu, 17 Apr 2008 11:00:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104102#M444707</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T11:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104103#M444708</link>
      <description>hey&lt;BR /&gt;&lt;BR /&gt;try it with quotes:&lt;BR /&gt;&lt;BR /&gt;if [[ "$ANS" != "hdisk[0-9]*" || "$ANS" != "vpath[0-9]*" ]] then&lt;BR /&gt;&lt;BR /&gt;regards</description>
      <pubDate>Thu, 17 Apr 2008 11:01:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104103#M444708</guid>
      <dc:creator>Oviwan</dc:creator>
      <dc:date>2008-04-17T11:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104104#M444709</link>
      <description>&amp;gt;is it to do with [[ ]] - should I be using [ ] for testing a pattern?&lt;BR /&gt;&lt;BR /&gt;Only [[ ]] does pattern matching, [ ] does exact match.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Oviwan: try it with quotes:&lt;BR /&gt;if [[ "$ANS" != "hdisk[0-9]*" || "$ANS" != "vpath[0-9]*" ]]&lt;BR /&gt;&lt;BR /&gt;No, that will break pattern matching.</description>
      <pubDate>Thu, 17 Apr 2008 11:03:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104104#M444709</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T11:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104105#M444710</link>
      <description>Hi dear,&lt;BR /&gt;       As I already post a solution, you can use the following command.&lt;BR /&gt;&lt;BR /&gt;if [[ $ANS != hdisk[0-9]* -a $ANS != vpath[0-9]* ]] ; then&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Piyush Mathiya&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 11:15:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104105#M444710</guid>
      <dc:creator>piyush mathiya</dc:creator>
      <dc:date>2008-04-17T11:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104106#M444711</link>
      <description>Which shell are you using?</description>
      <pubDate>Thu, 17 Apr 2008 11:21:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104106#M444711</guid>
      <dc:creator>OFC_EDM</dc:creator>
      <dc:date>2008-04-17T11:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104107#M444712</link>
      <description>Hi,&lt;BR /&gt;your pattern hdisk[0-9]* will not work in if condition.&lt;BR /&gt;&lt;BR /&gt;print "Please enter a hdisk or vpath you would like to check and potentially remove: \c"&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;read ANS&lt;BR /&gt;a=`echo $ANS|awk '/hdisk[0-9]/ {print $0}'`&lt;BR /&gt;b=`echo $ANS|awk '/vpath[0-9]/ {print $0}'`&lt;BR /&gt;&lt;BR /&gt;if [ $a ] || [ $b ] ; &lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;break&lt;BR /&gt;&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks &amp;amp; regards&lt;BR /&gt;&lt;BR /&gt;aashique</description>
      <pubDate>Thu, 17 Apr 2008 11:23:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104107#M444712</guid>
      <dc:creator>Aashique</dc:creator>
      <dc:date>2008-04-17T11:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104108#M444713</link>
      <description>&amp;gt;O'Kevin: Which shell are you using?&lt;BR /&gt;&lt;BR /&gt;Chris is obviously using a real shell and not the scummy C shell.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Aashique: your pattern hdisk[0-9]* will not work in if condition.&lt;BR /&gt;&lt;BR /&gt;Why not?  Pattern matching will work in [[ ]].</description>
      <pubDate>Thu, 17 Apr 2008 11:28:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104108#M444713</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T11:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104109#M444714</link>
      <description>Hi,&lt;BR /&gt;I check this way and its running.&lt;BR /&gt;$ more test                                                             &lt;BR /&gt;ANS=vpath02&lt;BR /&gt;a=`echo $ANS|awk '/hdisk[0-9]/ {print $0}'`&lt;BR /&gt;b=`echo $ANS|awk '/vpath[0-9]/ {print $0}'`&lt;BR /&gt;&lt;BR /&gt;if [ $a ] || [ $b ]&lt;BR /&gt;then&lt;BR /&gt;echo " YES"&lt;BR /&gt;else&lt;BR /&gt;echo "NO"&lt;BR /&gt;fi&lt;BR /&gt;$ ./test&lt;BR /&gt; YES&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 11:35:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104109#M444714</guid>
      <dc:creator>Aashique</dc:creator>
      <dc:date>2008-04-17T11:35:21Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104110#M444715</link>
      <description>just back from lunch&lt;BR /&gt;&lt;BR /&gt;Ok thanks all,&lt;BR /&gt;&lt;BR /&gt;I'll give take a look at these suggestions and let you know ...</description>
      <pubDate>Thu, 17 Apr 2008 11:39:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104110#M444715</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-17T11:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104111#M444716</link>
      <description>thanks all for the help and suggestions - Dennis gave the best solution for the korn shell!&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;&lt;BR /&gt;print "Please enter a hdisk or vpath you would like to check and potentially remove: \c"&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;read ANS&lt;BR /&gt;&lt;BR /&gt;        if [[ $ANS = hdisk[0-9]* || $ANS = vpath[0-9]* ]] ; then&lt;BR /&gt;&lt;BR /&gt;                break&lt;BR /&gt;                print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;        else&lt;BR /&gt;&lt;BR /&gt;                print "incorrect selection please enter a valid hdisk or vpath: \c"&lt;BR /&gt;&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;echo $ANS&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 11:48:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104111#M444716</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2008-04-17T11:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104112#M444717</link>
      <description>&lt;!--!*#--&gt;hi chris,&lt;BR /&gt;&lt;BR /&gt;have a look the following url:&lt;BR /&gt;&lt;A href="http://www.injunea.demon.co.uk/pages/page205.htm" target="_blank"&gt;http://www.injunea.demon.co.uk/pages/page205.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;should look something like:&lt;BR /&gt;if [ $ANS != hdisk[0-9]*  ] || [ $ANS != vpath[0-9]* ]&lt;BR /&gt;then&lt;BR /&gt;..&lt;BR /&gt;&lt;BR /&gt;(unfortunately, i do not have any machine at hand to validate this right now!)&lt;BR /&gt;&lt;BR /&gt;The [[ ]] are not properly stated.&lt;BR /&gt;&lt;BR /&gt;hope this helps!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 17 Apr 2008 12:01:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104112#M444717</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2008-04-17T12:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: trouble with "||" operand</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104113#M444718</link>
      <description>&amp;gt;Yogeeraj: have a look the following URL:&lt;BR /&gt;&lt;A href="http://www.injunea.demon.co.uk/pages/page205.htm" target="_blank"&gt;http://www.injunea.demon.co.uk/pages/page205.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This appears to be Borne shell document, not ksh or posix.&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-60130/sh-posix.1.html" target="_blank"&gt;http://docs.hp.com/en/B2355-60130/sh-posix.1.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://docs.hp.com/en/B2355-60130/ksh.1.html" target="_blank"&gt;http://docs.hp.com/en/B2355-60130/ksh.1.html&lt;/A&gt;</description>
      <pubDate>Thu, 17 Apr 2008 18:31:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/trouble-with-quot-quot-operand/m-p/5104113#M444718</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-04-17T18:31:41Z</dc:date>
    </item>
  </channel>
</rss>

