Hi I am new to shell script programming...
want to know the process of the following:
if[ -n "$MISSINGOPTARG"]
then
echo "$0: missing argument for option(s) :$MISSINGOPTARG"
echo "usage" $USAGE"
exit 1
fi
Hi I am new to shell script programming...
want to know the process of the following:
if[ -n "$MISSINGOPTARG"]
then
echo "$0: missing argument for option(s) :$MISSINGOPTARG"
echo "usage" $USAGE"
exit 1
fi
-n "$MISSINGOPTARG"
-n option checks whether $MISSINGOPTARG contain any text in it.
You have to use -z option to check whether $MISSINGOPTARG is empty and if it is empty then condition -z "$MISSINGOPTARG" is true
if[ -z "$MISSINGOPTARG" ]
then
echo "$0: missing argument for option(s) :$MISSINGOPTARG"
echo "usage" $USAGE"
exit 1
fi