UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 45.25 Shell Scripts On-the-Fly from Standard Input Chapter 45
Shell Programming for the Initiated
Next: 45.27 Turn Off echo for "Secret" Answers
 

45.26 Quoted hereis Document Terminators: sh vs. csh

At the times you need to quote your hereis document (8.18) terminators there's an annoying problem: sh and csh demand different conventions. If you are using sh, you must not quote the terminator. For example,

#! /bin/sh
cat << 'eof'
Hi there.
eof

If you are using csh, however, you must quote the terminator. The script:

#! /bin/csh
cat << \eof
Hi.  You might expect this to be the only line, but it's not.
eof
'e'of
\eof

prints three lines, not one.

- CT in net.unix-wizards on Usenet, 20 July 1984


Previous: 45.25 Shell Scripts On-the-Fly from Standard Input UNIX Power ToolsNext: 45.27 Turn Off echo for "Secret" Answers
45.25 Shell Scripts On-the-Fly from Standard Input Book Index45.27 Turn Off echo for "Secret" Answers

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System


Banner.Novgorod.Ru