Bash: while loop - break - continue
examples/shell/while_loop.sh
count=5 while [ $count -lt 10 ]; do echo $count sleep 1 count=$(($count + 1)) done
examples/shell/while_loop_break.sh
count=5 while true; do echo $count sleep 1 count=$(($count + 1)) if [ $count -gt 9 ]; then break fi done
examples/shell/while_loop_continue.sh
count=5 while true; do echo $count sleep 1 if [ $count -lt 9 ]; then count=$(($count + 1)) continue fi break done
Published on 2019-04-09
If you have any comments or questions, feel free to post them on the source of this page in GitHub. Source on GitHub.
Comment on this post