<?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: Help regarding while loop. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162716#M90778</link>
    <description>&lt;!--!*#--&gt;Hi Raghu:&lt;BR /&gt;&lt;BR /&gt;Here's another shell variation.  Change the values of MAXSECS, STEP and FILE to meet your needs.&lt;BR /&gt;&lt;BR /&gt;# cat ./watch&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i MAXSECS=15&lt;BR /&gt;typeset -i STEP=3&lt;BR /&gt;typeset    FILE=/tmp/mything&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;    if [ -f "${FILE}" ]; then&lt;BR /&gt;        echo "'${FILE}' is now available"&lt;BR /&gt;        break&lt;BR /&gt;    fi&lt;BR /&gt;    MAXSECS=${MAXSECS}-${STEP};&lt;BR /&gt;    if (( ${MAXSECS} &amp;lt; 0 )); then&lt;BR /&gt;        echo "No file seen"&lt;BR /&gt;        exit 1&lt;BR /&gt;    fi&lt;BR /&gt;    sleep ${STEP}&lt;BR /&gt;done&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 17 Mar 2008 11:06:42 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2008-03-17T11:06:42Z</dc:date>
    <item>
      <title>Help regarding while loop.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162714#M90776</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;Looking for a pointer for the following.&lt;BR /&gt;Script should Wait for a response file ( some text file) for 100mins, if the file comes with in 100min, script should continue.&lt;BR /&gt;If the file doesn't arrive after 100min, it needs to abort the script. &lt;BR /&gt;Can you please through some pointer on this.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Raghu.</description>
      <pubDate>Mon, 17 Mar 2008 09:30:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162714#M90776</guid>
      <dc:creator>Raghu Chikkamenahalli</dc:creator>
      <dc:date>2008-03-17T09:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding while loop.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162715#M90777</link>
      <description>I'm going to assume you're writing a shell script rather than (for example) a C program.&lt;BR /&gt;&lt;BR /&gt;while :&lt;BR /&gt;do&lt;BR /&gt;if &lt;BR /&gt;   [ -f $your_file ]&lt;BR /&gt;then&lt;BR /&gt;   do next bit of script&lt;BR /&gt;else&lt;BR /&gt;   let counter=counter+1&lt;BR /&gt;   if &lt;BR /&gt;     [ $counter == 10 ]&lt;BR /&gt;   then&lt;BR /&gt;     break&lt;BR /&gt;   else&lt;BR /&gt;     sleep 600&lt;BR /&gt;   fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;This tests for the existence of the file every 10 minutes. If the counter reaches 10, 100 minutes have elapsed and the script breaks if the file does not exists. If you want to check more often, reduce 600 and increase counter.&lt;BR /&gt;&lt;BR /&gt;I haven't tested this - it's "back of an envelope" stuff - so it may need a tweak or two, but I think it will set you on the way.&lt;BR /&gt;&lt;BR /&gt;Mark Syder (like the drink but spelt different)</description>
      <pubDate>Mon, 17 Mar 2008 09:43:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162715#M90777</guid>
      <dc:creator>MarkSyder</dc:creator>
      <dc:date>2008-03-17T09:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding while loop.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162716#M90778</link>
      <description>&lt;!--!*#--&gt;Hi Raghu:&lt;BR /&gt;&lt;BR /&gt;Here's another shell variation.  Change the values of MAXSECS, STEP and FILE to meet your needs.&lt;BR /&gt;&lt;BR /&gt;# cat ./watch&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i MAXSECS=15&lt;BR /&gt;typeset -i STEP=3&lt;BR /&gt;typeset    FILE=/tmp/mything&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;    if [ -f "${FILE}" ]; then&lt;BR /&gt;        echo "'${FILE}' is now available"&lt;BR /&gt;        break&lt;BR /&gt;    fi&lt;BR /&gt;    MAXSECS=${MAXSECS}-${STEP};&lt;BR /&gt;    if (( ${MAXSECS} &amp;lt; 0 )); then&lt;BR /&gt;        echo "No file seen"&lt;BR /&gt;        exit 1&lt;BR /&gt;    fi&lt;BR /&gt;    sleep ${STEP}&lt;BR /&gt;done&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 17 Mar 2008 11:06:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162716#M90778</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-03-17T11:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help regarding while loop.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162717#M90779</link>
      <description>Hi JRF,&lt;BR /&gt;&lt;BR /&gt;Awesome script. Great help indeed.&lt;BR /&gt;&lt;BR /&gt;Regards.&lt;BR /&gt;Raghu</description>
      <pubDate>Mon, 17 Mar 2008 13:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-regarding-while-loop/m-p/4162717#M90779</guid>
      <dc:creator>Raghu Chikkamenahalli</dc:creator>
      <dc:date>2008-03-17T13:01:58Z</dc:date>
    </item>
  </channel>
</rss>

