Re: assign a string variable onto itself with concat ksh
- From: Glenn Jackman <glennj@xxxxxx>
- Date: 28 Sep 2006 20:38:58 GMT
At 2006-09-28 03:58PM, "theshowmecanuck" wrote:
I am trying to weed out mutually exclusive command line options by[...]
Or is there an easier way to check for mutually exclusive options?
I'd write it like:
arg_o=""
arg_r=""
do_help=no
while getopts ":o:r:h" param; do
case "$param" in
h) do_help=yes ;; # delay help to allow for error processing
o) arg_o="$OPTARG" ;;
r) arg_r="$OPTARG" ;;
:) echo "missing argument for '-$OPTARG'"; exit 1 ;;
?) echo "unknown option: '-$OPTARG'"; exit 1 ;;
esac
done
if [ -n "$arg_r" -a -n "$arg_o" ]; then
echo "can't specify both -o and -r"
exit 1
fi
if [ $do_help = yes ]; then
usage
exit
fi
--
Glenn Jackman
Ulterior Designer
.
- References:
- assign a string variable onto itself with concat ksh
- From: theshowmecanuck
- Re: assign a string variable onto itself with concat ksh
- From: Bruce Barnett
- Re: assign a string variable onto itself with concat ksh
- From: theshowmecanuck
- assign a string variable onto itself with concat ksh
- Prev by Date: Re: From a bash array to a csv file line?
- Previous by thread: Re: assign a string variable onto itself with concat ksh
- Next by thread: Re: assign a string variable onto itself with concat ksh
- Index(es):
Relevant Pages
|