I created a script with the standard getopt
magic, so you can call the script with
batman-connect -c ffki
How can I add an option to call this script with only one option without dash?
batman-connect ffki
so It will interpret this only option as the second argument for -c
?
According to this answer I tried:
if [ $@ = "ffki" ]; then
set -- "-c $@"
fi
But that gives an error, I think because this line in my script will change it back:
# Execute getopt on the arguments passed to this program, identified by the special character $@
PARSED_OPTIONS=$(getopt -n "$0" -o hsrvVi:c: --long "help,start,restart,stop,verbose,vv,version,interface:,community:" -- "$@")
I don't like to re-arrange my whole script, so is there a simple one-liner to just set the first argument to "-c" and the second to "ffki" ?