<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695344#M56519</link>
    <description>You can simplify this a bit:&lt;BR /&gt;&lt;BR /&gt;filecheck=$(find . -name "test*.txt")&lt;BR /&gt;[[ "$filecheck" = "" ]] &amp;amp;&amp;amp; exit&lt;BR /&gt;&lt;BR /&gt;Note the use of $( &lt;COMMAND&gt; ) which is preferred over the archaic form: ` &lt;COMMAND&gt; ` (see man sh-posix and man ksh).&lt;/COMMAND&gt;&lt;/COMMAND&gt;</description>
    <pubDate>Tue, 02 Apr 2002 14:09:11 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2002-04-02T14:09:11Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695337#M56512</link>
      <description>Hi All,  I am having a problem in if statement, here's what i have....&lt;BR /&gt;filecheck=`find . -name "test*.txt"`&lt;BR /&gt;&lt;BR /&gt;if [  $filecheck -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;What I am trying to get is if $filechekc is empty then script exit else it continue, but i am getting the following error&lt;BR /&gt;&lt;BR /&gt;./test[4]: test: argument expected&lt;BR /&gt;&lt;BR /&gt;Can someone tell me what i'm doing wrong&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Apr 2002 13:44:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695337#M56512</guid>
      <dc:creator>Anthony khan</dc:creator>
      <dc:date>2002-04-02T13:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695338#M56513</link>
      <description>filecheck=`find . -name "test*.txt"` &lt;BR /&gt;&lt;BR /&gt;if [ $filecheck -eq 0 ] &lt;BR /&gt;then &lt;BR /&gt;exit &lt;BR /&gt;fi &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If find does not find anything $filecheck will remaing empty so ... two ways:&lt;BR /&gt;&lt;BR /&gt;if [ "$filecheck" -ne "" ] ...&lt;BR /&gt;&lt;BR /&gt;or better&lt;BR /&gt;if [ -n "$filecheck" ]....&lt;BR /&gt;&lt;BR /&gt;See man test.</description>
      <pubDate>Tue, 02 Apr 2002 13:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695338#M56513</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2002-04-02T13:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695339#M56514</link>
      <description>The test statement in if is not quite right. It should be ..&lt;BR /&gt;&lt;BR /&gt;if [ $filecheck = "" ]&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;which test for empty strings. The one that you use test for numbers.&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Apr 2002 13:55:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695339#M56514</guid>
      <dc:creator>S.K. Chan</dc:creator>
      <dc:date>2002-04-02T13:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695340#M56515</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Another way:-&lt;BR /&gt;&lt;BR /&gt;--------------------------------&lt;BR /&gt;cd &lt;TEST dir=""&gt;&lt;BR /&gt;&lt;BR /&gt;counter=`ll -R | grep test.file | wc -l`  &lt;BR /&gt;if [[ $counter = 0 ]]                     &lt;BR /&gt;then                                      &lt;BR /&gt;&lt;DO no="" file="" bit=""&gt;                              &lt;BR /&gt;exit                                      &lt;BR /&gt;                                      &lt;BR /&gt;&lt;DO found="" file="" bit=""&gt;&lt;BR /&gt;fi                          &lt;BR /&gt;-----------------------------------&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Paula&lt;/DO&gt;&lt;/DO&gt;&lt;/TEST&gt;</description>
      <pubDate>Tue, 02 Apr 2002 14:05:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695340#M56515</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2002-04-02T14:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695341#M56516</link>
      <description>Anthony,&lt;BR /&gt;&lt;BR /&gt;Another option is to add a line count:&lt;BR /&gt;&lt;BR /&gt;filecheck=`find . -name "test*.txt" | wc -l`&lt;BR /&gt;&lt;BR /&gt;This way you don't have to change your if statement.&lt;BR /&gt;&lt;BR /&gt;HtH,&lt;BR /&gt;&lt;BR /&gt;Mark</description>
      <pubDate>Tue, 02 Apr 2002 14:05:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695341#M56516</guid>
      <dc:creator>Mark van Hassel</dc:creator>
      <dc:date>2002-04-02T14:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695342#M56517</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;The problem you are seeing is that you are comparing a null value with zero which is not possible.&lt;BR /&gt;&lt;BR /&gt;A better way to go about it is   doing the following.&lt;BR /&gt;&lt;BR /&gt;if [ $filecheck ]&lt;BR /&gt;then&lt;BR /&gt;    echo "a value exists"&lt;BR /&gt;else&lt;BR /&gt;    echo "nothing"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;This way if $filecheck is empty it is false if some value is moved to $filecheck it is always true.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Apr 2002 14:06:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695342#M56517</guid>
      <dc:creator>Corthouts Carlo</dc:creator>
      <dc:date>2002-04-02T14:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695343#M56518</link>
      <description>Make sure you export the filecheckc variable.&lt;BR /&gt;Also use the "=" instead of "-eq". Scripts act a little funny with the alpha characters instead of the symbols when using numbers.&lt;BR /&gt;Hope this helps...&lt;BR /&gt;&lt;BR /&gt;David</description>
      <pubDate>Tue, 02 Apr 2002 14:08:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695343#M56518</guid>
      <dc:creator>David Diaz</dc:creator>
      <dc:date>2002-04-02T14:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695344#M56519</link>
      <description>You can simplify this a bit:&lt;BR /&gt;&lt;BR /&gt;filecheck=$(find . -name "test*.txt")&lt;BR /&gt;[[ "$filecheck" = "" ]] &amp;amp;&amp;amp; exit&lt;BR /&gt;&lt;BR /&gt;Note the use of $( &lt;COMMAND&gt; ) which is preferred over the archaic form: ` &lt;COMMAND&gt; ` (see man sh-posix and man ksh).&lt;/COMMAND&gt;&lt;/COMMAND&gt;</description>
      <pubDate>Tue, 02 Apr 2002 14:09:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695344#M56519</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2002-04-02T14:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695345#M56520</link>
      <description>Anthony,&lt;BR /&gt;&lt;BR /&gt;It doesn't work because you're trying to compare a string with a number (and probably an empty string by the look of the error message).&lt;BR /&gt;&lt;BR /&gt;So I suggest that you add:&lt;BR /&gt;&lt;BR /&gt;   | wc -w&lt;BR /&gt;&lt;BR /&gt;To the find command, so it spits out the number of ocurrences found (as it is now, it will only collect the files found).&lt;BR /&gt;Afterwards, you can compare numbers to numbers.&lt;BR /&gt;Just in case you get nothing from the variable, you should also prefix the $filecheck with a zero, so it has always a value:&lt;BR /&gt;&lt;BR /&gt;if [ 0$filecheck -eq 0 ]&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;&lt;BR /&gt;Rumagoso</description>
      <pubDate>Tue, 02 Apr 2002 14:09:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695345#M56520</guid>
      <dc:creator>Rui Soares</dc:creator>
      <dc:date>2002-04-02T14:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695346#M56521</link>
      <description>hi &lt;BR /&gt;&lt;BR /&gt;try this&lt;BR /&gt;&lt;BR /&gt;&lt;UR find="" statement="" goes="" here=""&gt;&lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;&lt;IF find="" is="" success="" do="" this=""&gt;&lt;BR /&gt;else&lt;BR /&gt;do this&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;regds&lt;BR /&gt;ravi&lt;/IF&gt;&lt;/UR&gt;</description>
      <pubDate>Tue, 02 Apr 2002 14:18:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/2695346#M56521</guid>
      <dc:creator>V. V. Ravi Kumar_1</dc:creator>
      <dc:date>2002-04-02T14:18:35Z</dc:date>
    </item>
  </channel>
</rss>

