Having a bit of trouble here. I haven't had to do long options ever, so I am trying getopt rather than getopts.
For some reason it keeps stating shift
as an unrecognized token.
Any reason why?
Also is this a proper implementation for getopt? Or is there a better method for this?
BASH SCRIPT BELOW:
FLAGS=$(getopt --long "help,user:" --name $PROGNAME -- "$@")
echo $FLAGS
eval set -- "$FLAGS"
while true; do
case $1 in
--help)
usage()
shift
;;
*)
shift
exit 1
;;
esac
shift
done
In Bash you don't call functions with brackets - usage()
should instead be usage
.