Bash

IF statement and While loop

IF STATEMENTS

If statements are great for evaluating a condition and taking certain action(s) based on the result. 

Example: 

a=10

b=20

if [[ $a == $b ]]

then 

echo 'yes'

else

echo 'no'

fi 


WHILE LOOPS

While loops are great for repeating and executing one (or more) commands until a condition is fulfilled. 

Example:

i=0 

while [ $i -lt 10 ]
do
echo $i 
i=$((i + 1)) 
done