UNIX Loops - KeynesYouDigIt/Knowledge GitHub Wiki

Loop Structure

[Loop Header]
do
    # Loop Body, reference iterator with $i
done

Loop Headers

for i in *
for i in $(ls -l)
for ((i=0; i<5; i++))
while [ $some_variable -lt 10 ]
until [ $some_variable -gt 10 ]

Loop Control

  • continue 3 - How many loops you want to jump up
  • break 3 - How many loops you want to jump up
  • wait [process_id]
  • exit
  • sleep 10 - (seconds)
⚠️ **GitHub.com Fallback** ⚠️