oracle:$ ./stop_all.sh
*****************************************************
** Stop all databases and listener
*****************************************************
./stop_all.sh: line 16: warning: here-document at line 12 delimited by end-of-file (wanted `EOF')
./stop_all.sh: line 17: syntax error: unexpected end of file
2018-06-28 10:24:02
oracle:$
Out of desperation, I tried re-typing the entire script from scratch - no copy and paste. This time it worked.
---------- Post updated 06-29-18 at 08:25 AM ---------- Previous update was 06-28-18 at 02:41 PM ----------
Well, I learned something today. I knew that the EOF had to be at the beginning of the line (immediately following x'0a', but never knew that it was also sensitive to trailing spaces. Thanks for catching that.
The Bourne shell is not a POSIX-compliant shell. The shell specified by the POSIX standard was based on the Bourne shell with some Korn shell changes and extensions.
/bin/sh on most Linux systems is a bash or dash shell with options set so that it is intended to act like a POSIX-compliant shell, but is not tested to conform to POSIX requirements by any POSIX or UNIX conformance test suite.
A here-document has two things that control how it works. In the form:
command <<word
contents
delimiter
where no part of word is quoted, the input fed into command is the result of performing parameter expansions, command substitutions, and arithmetic expansions on contents . If any part of word is quoted, the input fed into command is contents . The end of contents is identified by a line containing exactly the contents of delimiter immediately followed by a <newline> character where delimiter is word after quote removal has been applied.
In the form:
command <<-word
contents
delimiter
all leading <tab> characters in each line of contents and in the terminating line containing delimiter are discarded before the actions mentioned above are applied. (Note that it is just leading <tab>s; not leading <tab>s and/or <space>s.)