Bash

The following gives an overview of all the bash commands I keep forgetting :D

Creating an array from a text file

mapfile -t myArray < file.txt

For loop syntax

# Iterate over an array of elements 

for zone in "${myArray[@]}"
do
    echo $zone
 
done

# for loop that runs 5 times
for i in {1..5}
do
   echo $i
done

# A representative three-expression example
for (( c=1; c<=5; c++ ))
do  
   echo "Welcome $c times"
done

# Infinite for loop
for (( ; ; ))
do
   echo "infinite loops [ hit CTRL+C to stop]"
done