I have here a working method of parsing input arguments however it seems redundant. I would like to shorten this code so it doesn't appear so repetitive.
tool.sh <file-to-use>
tool.sh <file-to-use> -o <output-file-name>
# If arguments are set and equals "-o" then set APP_NAME
if [[ -n $3 ]] && [[ $2 = "-o" ]]; then
APP_NAME=$3
# If argument is set and equals anything besides "-o" throw error and show help menu
elif [[ -n $2 ]] && [[ $2 != "-o" ]]; then
echo "ERROR: Synatx error."
bash $0 -h
exit
# If "-o" is set but they did not give a output name throw error and display help menu
elif [[ -z $3 ]] && [[ $2 = "-o" ]]; then
echo "ERROR: Did not specify output file name."
bash $0 -h
exit
fi