[net.general] !FUNKY!STUFF!

sundar@cwruecmp.UUCP (06/17/83)

Thank you for your innumerable responses. Looks like I was the only one
who didn't know what "Funky!Stuff!" meant. Now I do. Thanks again.

sundar		sundar.Case@UDel-Relay

sundar@cwruecmp.UUCP (06/22/83)

!FUNKY!STUFF!

There have been a few requests for explanation of this strange looking
string of characters. Rather than reply to each one of them
individually, I have chosen to insert this item here. I hope you all
receive this.

!FUNKY!STUFF! is assumed to be so unique that it is very unlikely to
come across it in normal text. Thus it finds use as a delimiter in a
few shell commands. For example, the concatenate command, 'cat' can be
used to read from stdin and output what is being read to a file by
redirecting the output:

		cat > File
		text
		text
		text
		...
		EOF (control-D for example)

To stop the reading, one would normally append the text to be read with
an EOF character so that 'cat' would terminate.  In some situations,
the command and the text might be part of a shell script where there
could be more commands following the EOF. Without any means of
termination, 'cat' would read everything until it hits the 'hard' EOF
of the shell script. The following could be used to prevent this from
occurring:

		cat > File << !FUNKY!STUFF
		text
		text
		text
		...
		!FUNKY!STUFF!
		command
		command

Here !FUNKY!STUFF! acts as a 'soft' EOF terminating the 'cat'. The '<<'
input redirection control says that read everything following this
command as input up to and excluding the delimiter appearing after
'<<'. The delimiter gets discarded.  Incidentally, the text following
the  'cat' above, is called the 'here document' because it is here
rather than some where else.

Thanks to all who shone light on this STUFF for me.

Enjoy!

	Sundar Iyengar		decvax!cwruecmp!sundar
				sundar.Case@UDel-Relay