if (branching)

bash provides a branching mechanism: if.

A condition is tested, if it is true, then commands after a then are executed, otherwise optional commands expressed after a else are executed.

Example:

if test f1 -nt f2        
then
  echo f1 est is newer
else
  echo f2 est is newer
fi

Several branching can be nested using elif (else if).

if test ...
then
 ...
elif test ...
then 
 ... 
elif test ... 
then
 ... 
else 
 ...
fi