The IF statement

Syntax

if condition; then
  command
{elif condition; then
  command}
[else
  command]
fi

Discussion

  • command may be a single command or multiple commands, which are either placed on different lines or divided by ; on the same line.
  • The elif branch (“else if”) is optional and may be repeated as needed.
  • The else branch is optional.

Further information

  • man test gives more information about condition.

2022-01-29