[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Shell script reading stdin?



On Sun, Jun 11, 2000 at 10:20:07AM +0200, Sven Burgener wrote:
> I've seen scripts like this and I'm wondering exactly what this line
> does:
> 
>     cat <<EOF > foo.scr
> 
> I guess that up to the "EOF" it reads text and puts that into the named
> script..? EOF means EndOfFile, correct? Any refs for this?

that is called a `here' document the << indicates that input should be
read until a certain keyword (in this case EOF) is found, then it
stops reading.

EOF is common but not special, it can just as easily be FOE, FOO, BAR
etc, i don't think it even has to be all caps but that helps avoid
accidently catching something legitimate in the here document itself. 

-- 
Ethan Benson
http://www.alaska.net/~erbenson/

Attachment: pgpZModVlYB5A.pgp
Description: PGP signature


Reply to: