|
Softwares ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Main /
WhileLoopExampleMain.WhileLoopExample HistoryHide minor edits - Show changes to output Changed lines 33-35 from:
to:
The script in bash -x mode ]$ bash -x while_loop + true ++ date +%s + touch PIC-1184928926.jpg + sleep 10 + true ++ date +%s + touch PIC-1184928936.jpg + sleep 10 ---- Changed lines 22-23 from:
to:
---- *The true control statement will execute the script below until CTRL+C is pressed or the script is killed. #!/bin/bash while true; do touch PIC-`date +%s`.jpg sleep 10 done Added lines 22-24:
Reference: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_09_02.html Added lines 1-22:
* While loop syantax: while control-commands; do other-commands; done Example: $ cat while_loop #!/bin/bash i="0" while [ $i -lt 4 ] do echo "this is whole loop $i" i=$[$i +1] sleep 10 done |