|
|
Question : Will a semicolon cause a shell script to skip lines or fail in any way?
|
|
Will a semicolon in a ksh script cause the script to fail or skip the next command? We built some scripts with a runfailedmsg function - one of the coders input the usage of the function as such: --------------------- EXCERPT FROM SCRIPT---------------------------------------------------------------------------- if [ -s $ERRFILE ] ; then echo "\n\n\nERROR: BatDimBuild.sh script failed on one or more processes." >> $LOGFILE 2>&1 echo " See Errors below:" >> $LOGFILE 2>&1 cat $ERRFILE >> $LOGFILE 2>&1
cat $PROCESSPATH/datafiles/FailedDimBuildMsg.txt > $FailedMsgBody echo "\nErrors occurred during one or more processes in BatDimBuild.sh script." >> $FailedMsgBody echo "See script logfile or error files listed below for more details:" >> $FailedMsgBody echo >> $FailedMsgBody ls -l $ERRFILE >> $FailedMsgBody
runfailedmsg;
exit 1 fi --------------------------------------------------------------------------------------------------------------------------------------------- And this appears to work - except it does not do the exit 1 - we are having a bit of discussion as to why the exit 1 was not passed to tivoli and one of the hackers looking at it said it was because the coder used a semicolon - these are used all over the place in our scripts and we have not noted failures - so can an expert tell me -- Will a semicolon cause it to skip lines or fail in any way?
|
Answer : Will a semicolon cause a shell script to skip lines or fail in any way?
|
|
is runfailedmsg a shell script??? maybe it uses own exit ... if so, better use full path and dot in beginning to reuse current shell
. /full/script/path
|
|
|
|