The case statement starts with the keyword 'case' followed by
the value to be tested and the keyword 'in'.
This is followed by series of options.
Each value to be tested is on a separate line with a closing parenthesis '' after it.
The code which should be executed comes after the value.
After that there should be a line with double semi-colon ;;
The general syntax of the case statement is:
case value in
pattern1) command(s)
;;
pattern2) command(s)
;;
patternN) command(s)
;;
esac
After all the commands are executed, the control is passed to the first statement after the esac.
Several values can be matched in the same line.
They must be separated from each other by a symbol.
For example:
case value in
pattern1pattern2
command
... ;;
Patterns are checked for a match in the order in which they appear. A command is always carried out after the first instance of a pattern.