[clue-tech] increment weather
Shawn Perry
redmop924 at comcast.net
Mon Feb 22 23:20:55 MST 2010
As another option from the bash man page
while list; do list; done
until list; do list; done
The while command continuously executes the do list as
long as the last command in list returns an exit status of zero. The
until command is identical to the while command,
except that the test is negated; the do list is
executed as long as the last command in list returns a non-zero exit
status. The exit status of the while and until commands is
the exit status of the last do list command executed, or
zero if none was executed.
On Mon, Feb 22, 2010 at 11:05 PM, David L. Anselmi <anselmi at anselmi.us> wrote:
> David L. Willson wrote:
>> I have a loop-counter that I want to increment from within the loop, having found that the next
>> two items in the array I'm iterating through belong to me. How can I do that?
>>
>> This illustrates my problem:
>>
>> for i in $(seq 10)
>
> What Dennis said. Your i isn't a loop counter, it's a list iterator that gets assigned at the
> beginning of each pass. Compare to:
>
> for i in foo bar baz
>
> I think in PHP there's an indexer that you can tweak on arrays but I don't think so in shell.
>
> But even on Dennis's form (or Jed's while loop, which is essentially the same) I wonder whether
> in-loop mods are a good idea. Remember what Kernighan said about debugging being harder than coding...
>
> Dave
> _______________________________________________
> clue-tech mailing list
> clue-tech at cluedenver.org
> http://cluedenver.org/mailman/listinfo/clue-tech
>
More information about the clue-tech
mailing list