[plug] Here documents

Leon Brooks leon at brooks.fdns.net
Fri Oct 3 16:07:42 WST 2003


On Fri, 3 Oct 2003 12:12, Cameron Patrick wrote:
> On Fri, Oct 03, 2003 at 12:01:03PM +0800, David Buddrige wrote:
> | cat <<EOF
> | some text that
> | I want to add
> | to the end of my
> | file
> | EOF
> |
> | >>somefile.txt

> Try moving the ">>somefile" to the top line, like so:

> cat >>somefile.txt <<EOF
> blah
> EOF

Also great for templating, like so:

cat >> logfile << TEOTWAWKI
<p>$(cat annotation.txt)
<p>=== This annotation added $(date +%Y%m%d.%H%M%S) by $USER.
TEOTWAWKI

Cheers; Leon

_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list