hi, here is a ksh script i wrote using getopts...
i want to find out how i can run it in default mode when no option is mentioned and no arguments are provided... ?
i.e if the script name is final1, then just running final1 should run in default mode....
while getopts 1:2:3:4: mode
do
case $mode in
1) echo "You have chosen mode1"
echo "user specified month and year"
echo $OPTARG
exit;
echo "Default, Current Month"
;;
2) echo " You have chosen mode2"
if -f $OPTARG
then
echo "File Specified Manually"
else
echo "Log error if files are missing"
fi
;;
3) echo "you have chosen mode 3"
echo "number of working Days"
case $OPTARG in
x)echo "Runs for all days of month";;
?) echo "Runs for working days only";;
esac
;;
4) echo "You have chosen mode 4"
echo "Client Selection mode"
exit;;
?) echo "Invalid mode is selected";;
esac
done