bash - while + until loops grouping?
Greetings,
I'm writing a simple backup script and need to use two loops. How can I include a loop within a loop? With the following, the program stalls at the end, it apparantly doesn't like the two done's next to each other. x=1 while [ -f test ] do until [ $x "=" 5 ] do echo $x " - not 5 yet!" let x=x+1 done done :Pengy: thanks! |
your nested loops are ok.
the program doesn't stall, it keeps running on the 1st loop: at the end of the 2nd loop, the file still exists but x=5 already, so the echo command isn't reached. |
Thanks for a quick reply!
I see now :) |
All times are GMT -5. The time now is 04:37 AM. |