1-)
$? , tells us that last command exit status code..usually success commands returns 0 , if fails return codes nonzero value.
2-)
set -- `getopt t: $*` , makes the positional parameters set to the " -t plus $* plus --" ,
so if you run this like -- >
./My_Script.sh -t weekly --> positonol paramertes equals to " -t weekly -- "
if you run this like -> -->
./My_Script.sh -t weekly monthly --> positonol paramertes equals to " -t weekly -- monthly "
but in this case as if ,
set -- `getopt t: $*` always returns zero.
3-)
50 01 * * * [ -f /home/k7/My_Script.sh ] && cd /data2/log/bin/oapi; ./My_Script.sh -t weekly > /dev/null 2>&1
this script will run every day every at 01:50.
if
"/home/k7/My_Script.sh" file is exist and regular file then run these commands
" cd /data2/log/bin/oapi; ./My_Script.sh -t weekly "
if
"/home/k7/My_Script.sh" file is not exist or is not regular file then runs this command
./My_Script.sh -t weekly
if you write full script , we can maybe more help..
regards
ygemici