I am having trouble coming up with the right combination of semicolons and/or braces. I'd like to do this, but as a one-liner from the command line:
while [ 1 ]
do
foo
sleep 2
done
I am having trouble coming up with the right combination of semicolons and/or braces. I'd like to do this, but as a one-liner from the command line:
while [ 1 ]
do
foo
sleep 2
done
For simple process watching use
watch
insteadBy the way, if you type it as a multiline (as you are showing) at the command prompt and then call the history with arrow up, you will get it on a single line, correctly punctuated.
Using
while
:Using
for
Loop:Using
Recursion
, (a little bit different than above, keyboard interrupt won't stop it)Colon is always "true":
You can use semicolons to separate statements:
If I can give two practical examples (with a bit of "emotion").
This writes the name of all files ended with ".jpg" in the folder "img":
This deletes them:
Just trying to contribute.