case statement

case word in
pattern) commands;;
pattern) commands;;
\bgroup\color{blue}$\ldots$\egroup
esac

Here esac denotes the end of the case statement. It is case spelt backwards!

Let's create a small script that expects one command line argument.

[alice@localhost sandbox]$ vim check.sh
[alice@localhost sandbox]$ cat check.sh 
#!/bin/bash

case $# in
0) echo "Usage: " $0 " <foldername>";;
esac
[alice@localhost sandbox]$ chmod +x check.sh 
[alice@localhost sandbox]$ ./check.sh 
Usage:  ./check.sh  <foldername>

Note that $# is the number of command line arguments and $0 is the name of the script as invoked.