Diesen Artikel gibt es auch in Deutsch!
This is a short How-to for a while loop which echoes “LOOP!” :
do echo "LOOP!"
- while: starts the loop (in the brackets there is the constraint). Because an undefined variable is always “true” the loop will restart endless.
- do: Contains what the loop should do. For this example it echoes “Loop!”.
- sleep X – The script wait X second before continuing. (3 seconds here).
- done – Ends the loop
You can save the script and run it in shell using “bash SCRIPTNAME” or use “chmod a+x” to make it runnable and start it by clicking at it.