Shell parameter existence

Hello

You know how to ask for the existence of one parameter and depending about it then do something, example:

Original script:
###################
USER=$1
PASS=$2

program1 $USER $PASS
###################

Desired shell
###################
USER=$1
PASS=$2
ARCH=$3
if [ <exists parameter 3 or ARCH variable>]
then
user $USER $PASS
elsif [ <not exists parameter 3 or ARCH variable>]
user $USER $PASS $ARCH
quit
fi
###################

Thanks in advance

Try....

if [ "$ARCH" ]
then
    echo is set
else
    echo is not set
fi

or try

if [[ $ARCH = 'FOO' -o $ARCH = 'BAR' ]]
 then
   echo "FOOBAR!"
elif [ $ARCH = 'CORN' ]
 then
   echo "CORN"
else
 echo "I DUNNO"
fi

Thank you guys :slight_smile: :wink: :eek: