<?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 if - then statement does'nt work in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247407#M677410</link>
    <description>&lt;!--!*#--&gt;I have the following simple scripts on HP-UX B.11.31&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;WK=`date +%W`&lt;BR /&gt;NWK=`expr $WK % 2`&lt;BR /&gt;if $NWK -eq "0"; then&lt;BR /&gt;        WKS="week-1";&lt;BR /&gt;else&lt;BR /&gt;        WKS="week-2";&lt;BR /&gt;fi&lt;BR /&gt;echo "today :" `date`&lt;BR /&gt;echo "#week :" $WK&lt;BR /&gt;echo "nweek :" $NWK $WKS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When I execute the result as follows:&lt;BR /&gt;./calcweek.sh[4]: 0:  not found.&lt;BR /&gt;today : Tue Jul 13 10:58:35 TST 2010&lt;BR /&gt;#week : 28&lt;BR /&gt;nweek : 0 week-2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The question is&lt;BR /&gt;1. what means " 0:  not found"&lt;BR /&gt;2. why if-then statement does'nt work? (if nweek=0 should "week-1")&lt;BR /&gt;&lt;BR /&gt;Thanks very much for your willingness to help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 13 Jul 2010 03:04:28 GMT</pubDate>
    <dc:creator>Sutoyo Kardi</dc:creator>
    <dc:date>2010-07-13T03:04:28Z</dc:date>
    <item>
      <title>if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247407#M677410</link>
      <description>&lt;!--!*#--&gt;I have the following simple scripts on HP-UX B.11.31&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;WK=`date +%W`&lt;BR /&gt;NWK=`expr $WK % 2`&lt;BR /&gt;if $NWK -eq "0"; then&lt;BR /&gt;        WKS="week-1";&lt;BR /&gt;else&lt;BR /&gt;        WKS="week-2";&lt;BR /&gt;fi&lt;BR /&gt;echo "today :" `date`&lt;BR /&gt;echo "#week :" $WK&lt;BR /&gt;echo "nweek :" $NWK $WKS&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;When I execute the result as follows:&lt;BR /&gt;./calcweek.sh[4]: 0:  not found.&lt;BR /&gt;today : Tue Jul 13 10:58:35 TST 2010&lt;BR /&gt;#week : 28&lt;BR /&gt;nweek : 0 week-2&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The question is&lt;BR /&gt;1. what means " 0:  not found"&lt;BR /&gt;2. why if-then statement does'nt work? (if nweek=0 should "week-1")&lt;BR /&gt;&lt;BR /&gt;Thanks very much for your willingness to help.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jul 2010 03:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247407#M677410</guid>
      <dc:creator>Sutoyo Kardi</dc:creator>
      <dc:date>2010-07-13T03:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247408#M677411</link>
      <description>&lt;!--!*#--&gt;&amp;gt; ./calcweek.sh[4]: 0:  not found.&lt;BR /&gt;&lt;BR /&gt;As a command, "$NWK" ("0") is not very&lt;BR /&gt;useful.  Perhaps something more like:&lt;BR /&gt;&lt;BR /&gt;      if test "$NWK" -eq 0 ; then&lt;BR /&gt;or:&lt;BR /&gt;      if [ "$NWK" -eq 0 ]; then&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;      man test&lt;BR /&gt;&lt;BR /&gt;(Quoting "$NWK" avoids syntax errors if NWK&lt;BR /&gt;is empty.  If "-eq" is a numeric test, then&lt;BR /&gt;quoting "0" may be more confusing than&lt;BR /&gt;helpful.  Some of your semi-colons&lt;BR /&gt;("WKS=...;") seem to be unnecessary.)</description>
      <pubDate>Tue, 13 Jul 2010 03:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247408#M677411</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-07-13T03:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247409#M677412</link>
      <description>I've made changes in my script:&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;WK=`date +%W`&lt;BR /&gt;NWK=`expr $WK % 2`&lt;BR /&gt;if ["$NWK" -eq 0]; then&lt;BR /&gt;        WKS="week-1"&lt;BR /&gt;else&lt;BR /&gt;        WKS="week-2"&lt;BR /&gt;fi&lt;BR /&gt;echo "weeks:" $WK $NWK $WKS&lt;BR /&gt;&lt;BR /&gt;The result is still same as previous:&lt;BR /&gt;./calcweek.sh[4]: [0:  not found.&lt;BR /&gt;weeks: 28 0 week-2&lt;BR /&gt;&lt;BR /&gt;I still expect your assistance.&lt;BR /&gt;Regards,</description>
      <pubDate>Tue, 13 Jul 2010 03:50:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247409#M677412</guid>
      <dc:creator>Sutoyo Kardi</dc:creator>
      <dc:date>2010-07-13T03:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247410#M677413</link>
      <description>&lt;!--!*#--&gt;&amp;gt; I've made changes in my script:&lt;BR /&gt;&amp;gt; [...]&lt;BR /&gt;&lt;BR /&gt;Perhaps you should try copy+paste.  Or be&lt;BR /&gt;more careful.  Sometimes, spaces can be&lt;BR /&gt;important.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; The result is still same as previous:&lt;BR /&gt;&amp;gt; [...]&lt;BR /&gt;&lt;BR /&gt;No, it's not the same.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; ./calcweek.sh[4]: 0:  not found.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; ./calcweek.sh[4]: [0: not found.&lt;BR /&gt;&lt;BR /&gt;See the difference?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;       man test&lt;BR /&gt;&lt;BR /&gt;Also, to see how "if" works:&lt;BR /&gt;&lt;BR /&gt;      man sh&lt;BR /&gt;      man sh-posix</description>
      <pubDate>Tue, 13 Jul 2010 04:06:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247410#M677413</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2010-07-13T04:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247411#M677414</link>
      <description>Thanks Steven,&lt;BR /&gt;&lt;BR /&gt;You are corect. Sametimes, spaces is very usefull. I was careless.&lt;BR /&gt;&lt;BR /&gt;Thanks for your explanation.&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Jul 2010 04:26:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247411#M677414</guid>
      <dc:creator>Sutoyo Kardi</dc:creator>
      <dc:date>2010-07-13T04:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: if - then statement does'nt work</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247412#M677415</link>
      <description>Thanks</description>
      <pubDate>Tue, 13 Jul 2010 04:28:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/if-then-statement-does-nt-work/m-p/5247412#M677415</guid>
      <dc:creator>Sutoyo Kardi</dc:creator>
      <dc:date>2010-07-13T04:28:29Z</dc:date>
    </item>
  </channel>
</rss>

