Skip to content

Instantly share code, notes, and snippets.

@tjt263
Last active May 12, 2016 18:29
Show Gist options
  • Save tjt263/95bab2a0d42f40547093cb1142e3e9e9 to your computer and use it in GitHub Desktop.
Save tjt263/95bab2a0d42f40547093cb1142e3e9e9 to your computer and use it in GitHub Desktop.
This script is an example of how to use getopts in a shell script. It is intended as a reference for demonstration purposes. Feel free to use it as a style template in scripts of your own.
#!/bin/bash
while getopts "h" opt; do
case $opt in
h ) echo "usage: $0 [-h]";
echo "this is just a style template.";
exit 0
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment