<?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 How to evaluate a ?: operator from a shell script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737939#M946321</link>
    <description>I need to evaluate a expression like:&lt;BR /&gt;          (A&amp;gt;B+1)?C+2:D&lt;BR /&gt;from a shell script without creating a shell function for parsing.&lt;BR /&gt;&lt;BR /&gt;note: A, B, C and D are shell environment variables.&lt;BR /&gt;&lt;BR /&gt;Can anyone help me ?&lt;BR /&gt;</description>
    <pubDate>Wed, 05 Jun 2002 06:52:07 GMT</pubDate>
    <dc:creator>Jdamian</dc:creator>
    <dc:date>2002-06-05T06:52:07Z</dc:date>
    <item>
      <title>How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737939#M946321</link>
      <description>I need to evaluate a expression like:&lt;BR /&gt;          (A&amp;gt;B+1)?C+2:D&lt;BR /&gt;from a shell script without creating a shell function for parsing.&lt;BR /&gt;&lt;BR /&gt;note: A, B, C and D are shell environment variables.&lt;BR /&gt;&lt;BR /&gt;Can anyone help me ?&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Jun 2002 06:52:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737939#M946321</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2002-06-05T06:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737940#M946322</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Use the if-then-else construct:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;if [ "$A" -gt "$B" ]&lt;BR /&gt;then&lt;BR /&gt;  result=`expr $C + 2`&lt;BR /&gt;else&lt;BR /&gt;  result="$D"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 05 Jun 2002 06:58:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737940#M946322</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-06-05T06:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737941#M946323</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Should be as follows:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;&lt;BR /&gt;temp=`expr $B + 1`&lt;BR /&gt;if [ "$A" -gt "$temp" ] &lt;BR /&gt;then &lt;BR /&gt;result=`expr $C + 2` &lt;BR /&gt;else &lt;BR /&gt;result="$D" &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 05 Jun 2002 07:03:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737941#M946323</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-06-05T07:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737942#M946324</link>
      <description>Hi Damian,&lt;BR /&gt;&lt;BR /&gt;Check out the following construction:&lt;BR /&gt;&lt;BR /&gt;if [ "$A" -gt `expr $B + 1` ]&lt;BR /&gt;then&lt;BR /&gt;      value=`expr $C + 2`&lt;BR /&gt;else&lt;BR /&gt;      value="$D"&lt;BR /&gt;fi&lt;BR /&gt;     &lt;BR /&gt;Allways stay on the bright side of life!&lt;BR /&gt;&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 05 Jun 2002 07:04:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737942#M946324</guid>
      <dc:creator>Peter Kloetgen</dc:creator>
      <dc:date>2002-06-05T07:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737943#M946325</link>
      <description>I see nobody understood me.&lt;BR /&gt;&lt;BR /&gt;Supose user types the ?: expression, i.e., I don't know the expression in advance.&lt;BR /&gt;&lt;BR /&gt;In the previous example, A, B, C and D are symbolic names for numerical values or environment variables. My script has no A, B, C or D variable names.</description>
      <pubDate>Wed, 05 Jun 2002 08:38:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737943#M946325</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2002-06-05T08:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737944#M946326</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Then you need to write a parser script language just for that, probably invent a new shell interpreter that does that. :)&lt;BR /&gt;&lt;BR /&gt;Hope this helps. Regards.&lt;BR /&gt;&lt;BR /&gt;Steven Sim Kok Leong</description>
      <pubDate>Wed, 05 Jun 2002 09:13:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737944#M946326</guid>
      <dc:creator>Steven Sim Kok Leong</dc:creator>
      <dc:date>2002-06-05T09:13:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737945#M946327</link>
      <description>Hi Damian,&lt;BR /&gt;&lt;BR /&gt;the shell (well, at least Bourne, Korn, POSIX) does not have the C-style operator "?:"!&lt;BR /&gt;If you really need to use that operator, why not use a C-interpreter?&lt;BR /&gt;There do exist some OpenSource implementations...&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Wodisch</description>
      <pubDate>Wed, 05 Jun 2002 16:31:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737945#M946327</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-06-05T16:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to evaluate a ?: operator from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737946#M946328</link>
      <description>Let me give you a plan B. Perl does have the ternary operator and if you use the eval function, the code is parsed and executed 'on the fly'.</description>
      <pubDate>Wed, 05 Jun 2002 16:52:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-evaluate-a-operator-from-a-shell-script/m-p/2737946#M946328</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-06-05T16:52:59Z</dc:date>
    </item>
  </channel>
</rss>

