use getopt in shell script
Hi,
I want to use getopt(1) to check the shell script's option and its' option arguments! e.g. test.sh --version|-V test.sh --update {a | b} when i type: test.sh --up it should prompt that it can not recognize --up this option, other than lack of option arguments test.sh --update it should prompt that it lacks of option arguments i wrote this shell script: #!/bin/bash ARGS=`getopt -o ab:c:: -l a-long,b-long:,c-long:: -- "$@"` but, when i input: ./test.sh --b-lo it prompts that the --b-lo lacks of arguments, other than it can not recognize it |
The error message from ./test.sh --b-lo is correct. --b-lo is an "unambiguous abbreviation" of the --b-long defined in your getopt command as requiring an option argument which is not present in ./test.sh --b-lo
|
All times are GMT -5. The time now is 04:28 PM. |