cat <<EOF

Hi,
Some shell scripts use cat like that:


cat >test.txt <<EOF
what I want to see in the file
EOF

I don’t understand how that works. I get the following error message:

…/create_prj.sh:51 here document ‘EOF’ unclosed

51 is the last line of script.

Alain.

Your sample works fine for me.Which shell are you using?
Try \EOF

Alain Bonnefoy wrote:

Hi,
Some shell scripts use cat like that:


cat >test.txt <<EOF
what I want to see in the file
EOF

I don’t understand how that works. I get the following error message:

./create_prj.sh:51 here document ‘EOF’ unclosed

51 is the last line of script.

Alain.

alain.bonnefoy@icbt.com sed in <3F967BBC.4020501@icbt.com>:

./create_prj.sh:51 here document ‘EOF’ unclosed

Consult the sh (ksh) document for more info,
but plain <<EOF will expand various substitutions.
You have to post the complete script to get a better advice but
<<‘EOF’ may do it.

kabe

Ok, I don’t know why I had a the previous error msg (sic!) but that
works better with quoted EOF as it prevent interpretation.

Thanks to both of you,
Alain.

kabe@sra-tohoku.co.jp a écrit:

alain.bonnefoy@icbt.com > sed in <> 3F967BBC.4020501@icbt.com> >:


./create_prj.sh:51 here document ‘EOF’ unclosed



Consult the sh (ksh) document for more info,
but plain <<EOF will expand various substitutions.
You have to post the complete script to get a better advice but
‘EOF’ may do it.