for l in $(cat file.txt|grep 'Status'| awk -F' ' '{print $2}'); do
if [ $l != "SUCCESS" ]; then
echo $l ": Errors found. Please check logfile status.log"
else
echo "Readjust memory for the remaining cdb instance"
su - oracle <<!
-- code here --
!
runAdjustMemory
fi
done
During execution, my script failed with
./myscript.sh: line 32: warning: here-document at line 20 delimited by end-of-file (wanted `!') ./myscript.sh: line 33: syntax error: unexpected end of file
Cause: The termination character, in this case the exclamation point ! was indented in the code.
Solution: Remove the formatting and pull the termination character all the way to the left margin of your editor:
for l in $(cat file.txt|grep 'Status'| awk -F' ' '{print $2}'); do
if [ $l != "SUCCESS" ]; then
echo $l ": Errors found. Please check logfile status.log"
else
echo "Readjust memory for the remaining cdb instance"
su - oracle <<!
-- code here --
!
runAdjustMemory
fi
done