Bash

Bash for loop

Source https://linuxize.com/post/bash-for-loop/ for loop for item in [LIST] do [COMMANDS] done loop overstrings for element in Hydrogen Helium Lithium Beryllium do echo "Element: $element" done loop over a number range for i in {0..3} do echo "Number: $i" done loop over number range and increment by 5 for i in {0..20..5} do echo "Number: $i" done loop over array elements BOOKS=('In Search of Lost Time' 'Don Quixote' 'Ulysses' 'The Great Gatsby') for book in "${BOOKS[@]}"; do echo "Book: $book" done The C-style Bash for loop for ((i = 0 ; i <= 1000 ; i++)); do echo "Counter: $i" done break and continue Statements for element in Hydrogen Helium Lithium Beryllium; do if [[ "$element" == 'Lithium' ]]; then break fi echo "Element: $element" done echo 'All Done!

Bash

Source https://linuxize.com/post/bash-for-loop/ Bash BASH for loop BASH while loop sha256: 1c5a97339ecb3835b5262ed063593b0cc61047fe118454cc0e41ff2a2a9b816a