1. Exit if there are not two or three arguments (two
variations):
if [ $# -ne 2 ] && [ $# -ne 3 ]; then exit 1; fi
if [ $# -lt 2 ] || [ $# -gt 3 ]; then exit 1; fi
2. Perform a mkdir if a directory does not exist:
test ! -d tempdir && mkdir tempdir
3. Wait for a file to become non-readable:
while test -r thefile
do
sleep 30
done
echo '"thefile" is no longer readable'
4. Perform a command if the argument is one of three strings
(two variations):
if [ "$1" = "pear" ] || [ "$1" = "grape" ] || [ "$1" = "apple" ]
then
command
fi
case "$1" in
pear|grape|apple) command ;;
esac