why am getting error ksh: syntax error: `fi' unexpected while running script
Hi All
I am getting error in one of my script on Sun Solaris box while running in the script thru command line but from cronjob it is working ........... here is the details.......... s024[/home/oracle]$. /home/oracle/scripts/arch_backup.ksh proddb ksh: syntax error: `fi' unexpected the part of script where if statement is used........... chk_err=`cat $LOG_PATH/archbck_$ORACLE_SID.$dt.log | grep "ERROR" | wc -l` chkerr=${chk_err:-0} if [ $chkerr -ne 0 ] then # mailx -s "$HOST Archbkp $ORACLE_SID Failed" $MAILTO < $LOG_PATH/archbck_$ORACLE_SID.$dt.log exit 1 else # mailx -s "$HOST Archbkp $ORACLE_SID Successful" $MAILTO < $LOG_PATH/archbck_$ORACLE_SID.$dt.log fi exit 0 --------------------------------- could any pls point out the cause of this error thanks in advance |
Make sure that is the only instance of "fi" in the entire script?
|
It's because the 'else' clause is empty.
Just put a # before the else as well. |
Thanks
u r right since I made comment the else part after that it was happening. Now I made comment to else as well and it is running fine from command prompt. One more doubt........ Now it is running fine from command prompt but that window got exit. any problem still exist or it is normal ...... pls note that I add #else with the script. Thanks once more for you kind and valuable reply. |
Quote:
Which window? |
All times are GMT -5. The time now is 01:39 AM. |