On Mon, May 15, 2000 at 10:18:53AM +0100, Noel Carroll wrote:
> What the hell is
> a 'here' file and is there more to it than just an _EOF_ flag as was
> detailed in the article.
Imagine you want to send a multi-line mail message from a script:
( echo This is a long message
echo and this is line 2
echo and this is line 3
echo don\'t forget to quote quotes
echo $USER will be substituted with username
) | mail -s "stupid message" kenn
You can also do this using here documents:
mail -s "stupid message" kenn <<END_OF_MESSAGE
This is a long message
and this is line 2
and this is line 3
don't need to quote quotes
$USER will not be substituted
This lets you 'inline' a bunch of data. You end the data with a line
containing only the token that follows the << operator.
If you want to make the content of the here document easier to
see, you can indent them with tabs and use <<- instead of <<.
Bash will remove the leading tabs.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!