Search notes:

Bash: if

if evaluates a commands (CMD) exit status ($?). An exit status of 0 is considered true, all other status are considered false.
if CMD; then
   ...
   ...
fi
if CMD; then
   ...
   ...
else
   ...
   ...
fi
if CMD; then
   ...
   ...
elif CMD2; then
   ...
   ...
else
   ...
   ...
fi
CMD might be a square bracket command.

See also

bash
https://github.com/ReneNyffenegger/about-Bash/tree/master/conditional-constructs

Index