Interview Prep/Shell Scripting/Arrays, conditionals and loops

What are the loop forms in Bash?

BeginnerConceptArrays, conditionals and loops
Answer
for host in web1 web2 web3; do ...; done        # list
for f in /var/log/app/*.log; do ...; done       # glob
for ((i = 1; i <= 5; i++)); do ...; done        # C-style
while systemctl is-active --quiet app; do sleep 5; done   # while condition succeeds
until curl -fsS localhost:8080/healthz; do sleep 2; done  # until it succeeds
while IFS= read -r line; do ...; done < file    # lines of a file

break exits the loop, continue skips to the next iteration; both accept a level number for nested loops (break 2).

All Shell Scripting questions Roadmap: Shell scripting (Bash)

More on Arrays, conditionals and loops