Reading values from the command line

Hi

I want to give the user the choice of whether or not they want to include a certain option when they run the script.

This is my getops:

while getopts " s: d: r f: e h " option
do
case $option in

f ) dsxfile="$OPTARG";;
d ) dbname="$OPTARG";;
s ) dsn="$OPTARG";;
r ) rangechk="-O";;
e ) verbose="--verbose";
reverb="--echo";;
h | ? | * ) displayHelp;exit;;

esac;
done

This is my variables:

dbname="$dbname"
dsn="$dsn"
dsxfile="$dsxfile"
rangechk="$rangechk"
verbose=""
reverb=""
module=`basename $0`
dsxdir="/var/local/dsx/import"
dsximp="/usr/local/bin/dsximp.exe"
dsxpids="/var/run/"

Example, this is how I run the script:

./dsximp --$rangechk --dsn=$dsn --dbname=$dbname --user=datasafe --password=datasafe --dsxfile=$dsxdir/$dsxfile
 

Basically, the user can specify whether or not they want to add the option rangechk

If they do, the script will be called with that option included, if they don't, then they can omit that option....

The variable rangechk is initialised to "-O"

How do I add it in my script to make it such?