I've found such behavior of bash GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) and even latest ( How to get version of dash? ) dash on Debian.
Bug as is:
/bin/echo "Silent Err 'unexpected EOF while looking for matching' Example:"
if [ 0 -eq 1 ]; then
/bin/echo "HERE IS MISTAKE WITHOUT QUOTE IN THE END
exit
fi
/bin/echo " BLACK HOLE "
/bin/echo " CODE WILL NEVER PROCEED "
if [ 0 -eq 1 ]; then
/bin/echo "SECOND MISTAKE
exit
fi
/bin/echo "normal code... will work";
/bin/echo "Good and silent exit without any notice about BLACK HOLE code..."
/bin/echo "exit."
Launching:
# bash bug_as_is.sh
Silent Err 'unexpected EOF while looking for matching' Example:
normal code... will work
Good and silent exit without any notice about BLACK HOLE code place...
exit.
Only if the first if then fi block will be quoted, than error appears:
# bash unbug.sh
Silent Err 'unexpected EOF while looking for matching' Example:
BLACK HOLE
CODE WILL NEVER PROCEED
unbug.sh: line 20: unexpected EOF while looking for matching `"'
unbug.sh: line 24: syntax error: unexpected end of file
Is it common known bug or I've found real diamond? (;
And what is backbone of this behavior?
BLACK HOLEetc is printed is not a bug, what makes you think it is? Hint: look at the syntax highlighting in your editor, or even in your question.