can anyone explain the code for me... i am new to shell programming
while getopts ":S:D:U:" OPTION "$@"
do
case $OPTION in
S) SRVR=$OPTARG;;
D) DB="$OPTARG"; USEDB="use $OPTARG";;
U) UID=$OPTARG;;
MISSINGOPTARG="$MISSINGOPTARG -$OPTARG";;
?) if [ "$OPTARG" = "?" ]
then
HELP=1
else
UNEXPECTEDOPT="$UNEXPECTEDOPT -$OPTARG";
fi;;
esac
done
HI,
while getopts ":S:D:U:" OPTION "$@" --->The possible options are specified
here
do
case $OPTION in
S) SRVR=$OPTARG;; -->Handling the option S -->OPTARG will have the
value for the oprion S
D) DB="$OPTARG"; USEDB="use $OPTARG";;
U) UID=$OPTARG;;
:) MISSINGOPTARG="$MISSINGOPTARG -$OPTARG";;
?) if [ "$OPTARG" = "?" ]
then
HELP=1
else
UNEXPECTEDOPT="$UNEXPECTEDOPT -$OPTARG";
fi;;
esac --->End of switch /case
done
Thanks
Raghuram