[mythtv-users] Quick script question

David George david at thegeorges.us
Wed Aug 15 18:27:06 UTC 2007


On 08/15/2007 01:31 PM, Sarah Katherine Hayes wrote:
> at the 
> momment I'm figuring out how to do an almighty do ... while loop in 
> bash.  I'm rather rusty and only ever did C.
>   

Here is a quick-and-dirty example of a while loop:

#/bin/bash
let i=0
while [[ $i -lt 9 ]]; do echo $i; ((i+=1)); done

If you always want the loop to run at least once you can use until:

#/bin/bash
let i=0
until [[ $i -eq 9 ]]; do echo $i; ((i+=1)); done

HTH,
-- 
David



More information about the mythtv-users mailing list