<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" <anselmi@anselmi.us><br>To: "CLUE technical discussion" <clue-tech@cluedenver.org><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>> I have a loop-counter that I want to increment from within the loop, having found that the next<br>> two items in the array I'm iterating through belong to me. How can I do that?<br>><br>> This illustrates my problem:<br>><br>> for i in $(seq 10)<br><br>What Dennis said. Your i isn't a loop counter, it's a list iterator that gets assigned at the <br>beginning of each pass. 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. Remember what Kernighan said about debugging being harder than coding...<br><br><br>Good point. I have used it, but usually it's better to start a new iteration. I think bash has a command for this purpose. It might be called "continue".<br></div></body></html>