lphillips120898
asked on
check for existence of 2 command line variables
The following checks for the existince of one variable being passed on the command line, and exits if it isn't there:
if [[ -n $1 ]]; then
print
else
print
print " ** Enter Node Name (i.e. createServerGroup.sh SpherionServerGroup) **\n"
exit 1
fi
How can I check for two variables being passed in the same if statment?
Thanks,
Lisa
if [[ -n $1 ]]; then
else
print " ** Enter Node Name (i.e. createServerGroup.sh SpherionServerGroup) **\n"
exit 1
fi
How can I check for two variables being passed in the same if statment?
Thanks,
Lisa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if [ $# = 2 ]; then
# two args
elif [ $# =1 ]; then
# only one arg
else
# something I'm not prepared to deal with
fi
should do the trick.