<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'><br>----- Original Message -----<br>From: "David L. Anselmi" &lt;anselmi@anselmi.us&gt;<br>To: "CLUE technical discussion" &lt;clue-tech@cluedenver.org&gt;<br>Sent: Monday, February 22, 2010 11:05:11 PM GMT -07:00 US/Canada Mountain<br>Subject: Re: [clue-tech] increment weather<br><br>David L. Willson wrote:<br>&gt; I have a loop-counter that I want to increment from within the loop, having found that the next<br>&gt; two items in the array I'm iterating through belong to me. &nbsp;How can I do that?<br>&gt;<br>&gt; This illustrates my problem:<br>&gt;<br>&gt; for i in $(seq 10)<br><br>What Dennis said. &nbsp;Your i isn't a loop counter, it's a list iterator that gets assigned at the <br>beginning of each pass. &nbsp;Compare to:<br><br>for i in foo bar baz<br><br>I think in PHP there's an indexer that you can tweak on arrays but I don't think so in shell.<br><br>But even on Dennis's form (or Jed's while loop, which is essentially the same) I wonder whether <br>in-loop mods are a good idea. &nbsp;Remember what Kernighan said about debugging being harder than coding...<br><br><br>Good point.&nbsp; I have used it, but usually it's better to start a new iteration.&nbsp; I think bash has a command for this purpose.&nbsp; It might be called "continue".<br></div></body></html>