I always forget this and spend ages finding out how to do it. How to test for an argument passed from the command line to a shell script, and not get "argument expected" error:
if [ -z "$1" ]; then
echo argument expected
exit 1
fi
The secret is the quotes around the $1.