9fans archive / 1997 / 07 / 19 /    prev next

From: erik quanstrom quanstro@Inf...
Subject: broken rc here documents.
Date: Tue, 8 Jul 1997 14:49:03 -0400

>Hi, 
>
>What should be the correct output for this rc fragment?
>
>{
>cat <<EOF
>hi there
>EOF
>}
>
>I'm getting 
>
>hi: file does not exist
>EOF: file does not exist

the last time i tried writing a shell (1992) i decided that 
here documents were *way* too much work when you consider the 
simple quoting rules of rc (and other reasonable shells). all
you really need to do is replace each ' with '' and then put
the whole thing in 's. at one point i'd written a version of
shar that used exactly this trick but i seem to have lost it.

the point is: here documents are almost impossible to get
right so why not Just Use Quotes?

erik