Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getopts



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





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org