[comp.unix.questions] SysV sh <<- silliness

dce@mips.UUCP (David Elliott) (01/09/87)

For the 5th time in three years, I've had someone complain that
their shell scripts break when using the System V shell because
they use things like

	cat <<-END_OF_FILE-
	...
	-END_OF_FILE-

For those of you that don't know about <<- in System V shell, it means
"strip off leading whitespace (or maybe just tabs) in the document
and the terminator". This nice feature allows you to indent your text,
but obviously it breaks working shell scripts (don't even talk to me
about 'include' in make).

Anyway, I just realized that the syntax <<# would have been a better
idea. Since <<# is syntactically illegal in the BSD and System V shells
already,

	1. no valid shell script could be broken by adding this
	2. if you tried to run a script that uses <<# with a shell
	   that doesn't support it, it breaks with a syntax error
	   instead of getting an unexpected end of file message.

Does anyone see a flaw in this thinking? Is AT&T listening? Do they care?

			David