Hi,
this is not strictly Debian-related, but I'm doing it on Etch, so... :)

Let's say I'm writing a script like this:

#! /bin/bash
SUBJECT="This is a test mail"
WARNMSG="An error occurred"
WARNCMD="mail -s \"${SUBJECT}\" root"

echo "echo $WARNMSG | $WARNCMD"
echo $WARNMSG | $WARNCMD

Everything works fine if I enter the equivalent command line:

        echo "An error occurred" | mail -s "This is a test mail" root

A mail is sent to root with subject "This is a test mail" and body "An error occurred".

The script should produce the same effect, but instead, when I run it, it sends a mail with subect <"This> and body "An error occurred" to the following users:

is
a
mail
, root, test

....although the command line printed by the first echo statement looks perfect.

It'a problem which has been bugging me for a while. I usually find some workaround, but I'm a bit tired now. An I suppose it should be some kind of FAQ... although I couldn't find anything around.

I already tried with single quotes, I tried escaping them, I tried escaping the spaces in the subject... to no avail.

Any clues?
Thanks.

--
Ciao,
  Marco.


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to