I have a simple shell script that executes a .sql script. When the .sql script has completed, the shell script sends an email to a specified address notifying whether or not the .sql script ran successfully.
My problem is that the subject line is being truncated. I am using a simple IF statement to determine the subject line:
grep 'ORA-' $OUTFILE > /dev/null 2>&1
if [ $? = 1 ]; then
ERRORS=n
SUBJECT= "$VERSION script successful"
else
ERRORS=y
SUBJECT="$VERSION script had error(s)"
fi
This works fine. However, when I execute the mailx command, the subject line is truncated to "Development" or "Production" depending on the version of the script that has been executed:
mailx -s $SUBJECT $EMAIL < $MAILFILE
I know the subject line needs to be in double quotes if it includes embedded spaces, but this does not seem to work correctly when assigned to a variable.
Is there a way around this? Is there a way to escape the double quotes