Wednesday, March 6, 2013

for loop inline bash style AND while ... loop

So simple, yet I always forget.

Here's how to do a for loop in inline bash:

for x in {1..30}; do foo1; foo2; done

Also how to do an inline while loop in bash:

while true; do foo; sleep 2; done

No comments:

Post a Comment

cancel script completely on ctrl-c

I found this question interesting: basically how to cancel completely a script and all child processes : You do this by creating a subro...