blob: e1b5656597fa9ef6c305baf73ff890efe78ff4e5 (
plain) (
tree)
|
|
#!/bin/bash
echo $0
echo $1
Help() {
echo "Add description of the script functions here."
echo
echo "Syntax: scriptTemplate [-g|h|v|V]"
echo "options:"
echo "g Print the GPL license notification."
echo "h Print this Help."
echo "v Verbose mode."
echo "V Print software version and exit."
echo
}
Name=World
#
# The while-done structure defines a loop that executes once for each option
# in the getopts - option structure. The ":h" string - which requires the quotes
# - lists the possible input options that will be evaluated by the case - esac
# structure. Each option listed must have a corresponding stanza in the case statement.
# exit;; exits from the program without executing any more code even if some
# exists. The option processing loop is also terminated, so no additional
# options would be checked
while getopts ":hn:" option; do
case $option in
h) # display Help
Help
exit;;
n) # Enter a name
Name=$OPTARG;;
\?) # invalid option
echo "Error: Invalid option"
echo $option
exit;;
esac
done
echo "Hello $Name"
|