getopts
Anthony J. Gabrielson
agabriel at home.tzo.org
Wed Jan 30 14:36:39 EST 2002
Hello,
I am trying to put together a script and I am running into a
slight problem. I need my script to take multiple variables from the
command line and use them. Here is what I have so far:
#!/bin/sh
#
# Handles Arguments
#
while getopts xy: option
echo $OPTARG
do
case $option in
x) xdim=$OPTARG;;
y) ydim=$OPTARG;;
\?) echo "usage: ds9sh [-x columns] [-y columns] file..."
exit 2;;
esac
done
shift `expr $OPTIND - 1`
#
# Program functionality is coming!
#
echo "X = $xdim"
echo "Y = $ydim"
If I use one variable it works fine, when I bring it to two it
breaks. I'm really hoping that someone will have insight into this
problem.
Thanks,
Anthony
More information about the Discuss
mailing list