Mail from a shell script?

Richard Lynch ceo at l-i-e.com
Mon Sep 13 17:57:35 PDT 2004


Ryan Sommers wrote:
> First problem I ran into. I'm attempting to send the mail via `which
> mail`. I first was going to attempt to concatenate the message via
> "message=${message}$'\n'<other line>" However, this strips the newlines
> out of the variable (both sh and bash). I then tried using the <<string
> redirection in bash/sh and same thing happened.

Things I would try:

Use \\n so that the first pass "eats up" \\ to product \ and then you have
\n where you want it.

Paste in a literal new-line (control-v/control-m in vi) so that you don't
have to rely on \n to work.

Also, in "man 5 crontab" there is reference to using %% or somesuch for
newlines in mail.  I'm not sure if that's a cron thing or a mail thing,
but it may be useful.

Dislaimer:  All of this comes from Linux/PHP experience, and not so much
FreeBSD.  YMMV.

-- 
Like Music?
http://l-i-e.com/artists.htm



More information about the freebsd-questions mailing list