Several example scripts illustrating how you can use getopt(1) with bash and tcsh. Note that getopt(1) should also work with other sh-derived and csh-derived shells. All programs are also attached below.
Testing which getopt(1) you are using
These scripts checks whether you are using the enhanced getopt(1) described on this site or an older version.
The version for bash and other sh-compatible shells (getopt-test.bash):