I have a bash code in which I have made a function which is called in the program. I forgot to put a quotation mark in one of the statement because of which the script threw a syntax error.Following is the code :
#function
write_errors()
{
#writes RIGHT TRUNCATION errors in bcp import
temp_file=$1
error_file=$2
stepName=$3
error_count=`fgrep -c "right truncation" ${error_file} "` #here is the extra quotation mark
...
}
#start of script
date
...
write_errors #syntax error happens here
...
date #these lines are executed
rm -f ${temp}
rm -f ${error_file}
...
#end of script
My question is after the syntax error in write_errors, why does bash executes the line after the syntax error happened ? Why doesn't it quit at the syntax error like other languages?