Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
getopts exclusive arguments
Name: ghjellyn Date: June 25, 2007 at 02:58:23 Pacific OS: HPUX CPU/Ram: ... Product: ...
Comment:
hi all
i got a ksh script where i want to do the following :
there are 3 possible arugments : a, b ,c and only one of them can be called.
#foo -a is ok
#foo -b -c is not ok
so i wrote the getopts part :
while getopts abc options do case $option in a)... b)... c)...
esac
what is a "clean way of checking that only one option (a or b or c) is used?
Summary: i just learned that when you use getopts, the argument after an option is stored in $OPTARG variable. how about if i have more than 1 arguments? if i'm not mistaken, $OPTARG gets 1 only. how can i g...
Summary: hi, can anyone kindly enlighten me what's wrong with my code? (p.s. only the -e option is done, the rest still under construction) set -- `getopt ":d:f:n:" "$@"` while [ ! -z "$1" ] ; do case "$1"...
Summary: Hey guys, I have searched around and cant find a simple answer. How do I pass run time arguments to a csh script? I just need the option to pass a single parameter to the program with one optional a...