Unix Power ToolsUnix Power ToolsSearch this book

36.19. Quoted hereis Document Terminators: sh Versus csh

When you need to quote your hereis document (Section 27.16) 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 following script prints three lines, not one:

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

-- CT



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.