<?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: break out of loop in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041560#M95778</link>
    <description>thanks chaps ...&lt;BR /&gt;&lt;BR /&gt;that has cleared some questions.</description>
    <pubDate>Fri, 20 Apr 2007 09:59:58 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2007-04-20T09:59:58Z</dc:date>
    <item>
      <title>break out of loop</title>
      <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041556#M95774</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am having sytax difficulty breaking out of a loop:&lt;BR /&gt;&lt;BR /&gt;while read FILES&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;  if [ -f archive.gz ] ; then&lt;BR /&gt;      &lt;BR /&gt;           break&lt;BR /&gt;&lt;BR /&gt;else&lt;BR /&gt;&lt;BR /&gt;for list in `ls $FILES`&lt;BR /&gt;do&lt;BR /&gt;cat $list &amp;gt;&amp;gt; $outfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;done  &amp;lt; $dirlist&lt;BR /&gt;&lt;BR /&gt;so funny as it seems dirlist contains a list of directories however if that directory has already been processed I want the script skip cat'ing all files in the dir and continue with the next directory in $dirlist however all that happens is the scripts exits&lt;BR /&gt;&lt;BR /&gt;I am obviously not using break correctly, any idea's?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Fri, 20 Apr 2007 08:00:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041556#M95774</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-04-20T08:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: break out of loop</title>
      <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041557#M95775</link>
      <description>looked into this again and realised I dont need break however using "continue" has resolved my issue.&lt;BR /&gt;&lt;BR /&gt;Still I thought break would have the same effect.</description>
      <pubDate>Fri, 20 Apr 2007 08:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041557#M95775</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-04-20T08:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: break out of loop</title>
      <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041558#M95776</link>
      <description>Based on what you say you want it to do, you simply want to do nothing if the archive.gz file exists and continue processing the remainder of the $dirlist so your code should look something like this:&lt;BR /&gt;&lt;BR /&gt;while read FILES&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;if [ ! -f archive.gz ]&lt;BR /&gt;then&lt;BR /&gt;&lt;BR /&gt;for list in `ls $FILES`&lt;BR /&gt;do&lt;BR /&gt;cat $list &amp;gt;&amp;gt; $outfile&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;done &amp;lt; $dirlist&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As for the break command, it's doing exactly what it's supposed to do. Per the sh-posix(1) man page:&lt;BR /&gt;&lt;BR /&gt;% break [n]  Exit from the enclosing for, select, until, or while loop, if any.  If n is specified, exit from n levels.</description>
      <pubDate>Fri, 20 Apr 2007 08:14:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041558#M95776</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2007-04-20T08:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: break out of loop</title>
      <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041559#M95777</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;depends on your programming logic.&lt;BR /&gt;&lt;BR /&gt;While "break" would leave the loop immediately&lt;BR /&gt;(note, that although you cannot specify labels like in Perl to distinguish which of several nested loops to exit, you may give braek an optional decimal that specifies the n'th level)&lt;BR /&gt;a "continue" would simply skip all the remaining execution block of a loop to enter the next iteration.&lt;BR /&gt;(needless to mention that "continue" also honours an optional loop level argument like "break").&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Apr 2007 08:21:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041559#M95777</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2007-04-20T08:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: break out of loop</title>
      <link>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041560#M95778</link>
      <description>thanks chaps ...&lt;BR /&gt;&lt;BR /&gt;that has cleared some questions.</description>
      <pubDate>Fri, 20 Apr 2007 09:59:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/break-out-of-loop/m-p/5041560#M95778</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-04-20T09:59:58Z</dc:date>
    </item>
  </channel>
</rss>

