<?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: simple test in a script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501032#M216660</link>
    <description>But how do i put this test after my until, do done so that if the file is empty, it goes back to the until do done?&lt;BR /&gt;&lt;BR /&gt;I need to loop it back.</description>
    <pubDate>Wed, 09 Mar 2005 10:18:16 GMT</pubDate>
    <dc:creator>Terrence</dc:creator>
    <dc:date>2005-03-09T10:18:16Z</dc:date>
    <item>
      <title>simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501029#M216657</link>
      <description>I have a portion of a script that needs a test statement to validate that a file has something in it and is not empty.  I compare a file to an earlier version of itself to make sure it's no longer growing.   However if the file is at zero to start and stays that way for too long the script will assume it's no longer growing and will continue.  I want the script to loop back to the compare if it finds the file is empty.  I know this is easy but I barely know how to script.&lt;BR /&gt;&lt;BR /&gt;until cmp -s $SOURCE /var/STOCK_ARCHIVE/$SOURCE&lt;BR /&gt; &lt;BR /&gt;        do&lt;BR /&gt;        cp -p $SOURCE /var/STOCK_ARCHIVE/&lt;BR /&gt;        sleep 300&lt;BR /&gt;        done</description>
      <pubDate>Wed, 09 Mar 2005 10:06:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501029#M216657</guid>
      <dc:creator>Terrence</dc:creator>
      <dc:date>2005-03-09T10:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501030#M216658</link>
      <description>To test for file existance and non-zero size do:&lt;BR /&gt;&lt;BR /&gt;if [ -s /dir/filename ] ; then&lt;BR /&gt;do something&lt;BR /&gt;else&lt;BR /&gt;doe something else&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;'man test' for more information and other options.</description>
      <pubDate>Wed, 09 Mar 2005 10:09:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501030#M216658</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2005-03-09T10:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501031#M216659</link>
      <description>Use the -s test&lt;BR /&gt;&lt;BR /&gt;if [ -s /var/STOCK_ARCHIVE/${SOURCE} ]&lt;BR /&gt;then&lt;BR /&gt;   file is not empty&lt;BR /&gt;else&lt;BR /&gt;   file is empty&lt;BR /&gt;fi</description>
      <pubDate>Wed, 09 Mar 2005 10:10:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501031#M216659</guid>
      <dc:creator>Gary L. Paveza, Jr.</dc:creator>
      <dc:date>2005-03-09T10:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501032#M216660</link>
      <description>But how do i put this test after my until, do done so that if the file is empty, it goes back to the until do done?&lt;BR /&gt;&lt;BR /&gt;I need to loop it back.</description>
      <pubDate>Wed, 09 Mar 2005 10:18:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501032#M216660</guid>
      <dc:creator>Terrence</dc:creator>
      <dc:date>2005-03-09T10:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501033#M216661</link>
      <description>Here's some little ditty for your notes on test conditions.&lt;BR /&gt;&lt;BR /&gt;The test condition or [condition]  - (K) = Korn shell specific&lt;BR /&gt;Testing Files&lt;BR /&gt;-a file  file exists   (K)&lt;BR /&gt;-b file  file exists and is a block special file.&lt;BR /&gt;-c file  file exists and is a character special file&lt;BR /&gt;-d file  file exists and is a directory&lt;BR /&gt;-e file  true if the file exists&lt;BR /&gt;-f file  file exists and is a regular file&lt;BR /&gt;-G file  file exists and its group is the effective group ID.   (K)&lt;BR /&gt;-g file  file exists and its set-group-id bit is set&lt;BR /&gt;-k file  file exists and its sticky bit is set.&lt;BR /&gt;-L file  file exists and is a symbolic link   (K)&lt;BR /&gt;-O file  file exists and its owner is the effective user ID   (K)&lt;BR /&gt;-o c  Option c is on   (K)&lt;BR /&gt;-p file  file exists and is a named pipe   (fifo)&lt;BR /&gt;-r file  file exists and is readable&lt;BR /&gt;-S file  file exists and is a socket   (K)&lt;BR /&gt;-s file  file exists and has a size grreater than zero&lt;BR /&gt;-t [n]  The open file descriptor n is associated with a terminal device; default n is 1&lt;BR /&gt;-u file  file exists and its set-user-id bit is set&lt;BR /&gt;-w file  file exists and is writable&lt;BR /&gt;-x file  file exists and is executable&lt;BR /&gt;f1 -ef f2 files f1 and f2 are linked (refer to same file)   (K)&lt;BR /&gt;f1 -nt f2 file f1 is newer than f2   (K)&lt;BR /&gt;f1 -ot f2 file f1 is older than f2   (K)&lt;BR /&gt;</description>
      <pubDate>Wed, 09 Mar 2005 10:21:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501033#M216661</guid>
      <dc:creator>Robert Bennett_3</dc:creator>
      <dc:date>2005-03-09T10:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501034#M216662</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.shelldorado.com" target="_blank"&gt;www.shelldorado.com&lt;/A&gt; will help&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also put a while loop round your loop&lt;BR /&gt;&lt;BR /&gt;while [ ! -s "/tmp/toto" ]&lt;BR /&gt;do&lt;BR /&gt;ll -d /tmp/toto&lt;BR /&gt;echo lala&lt;BR /&gt;sleep 30&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As long as /tmp/toto is zero length loop continues&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;          Steve Steel</description>
      <pubDate>Wed, 09 Mar 2005 10:30:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501034#M216662</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2005-03-09T10:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: simple test in a script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501035#M216663</link>
      <description>Thanks Steve - shelldorado.com just went into my favorites....nice site.&lt;BR /&gt;&lt;BR /&gt;B</description>
      <pubDate>Wed, 09 Mar 2005 10:44:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/simple-test-in-a-script/m-p/3501035#M216663</guid>
      <dc:creator>Robert Bennett_3</dc:creator>
      <dc:date>2005-03-09T10:44:25Z</dc:date>
    </item>
  </channel>
</rss>

