talonso's suggestion about quotes around the $message worked nicely and
required the least modification, so I went with that.
Thank you all for your replies!
--
This message posted from opensolaris.org
___
opensolaris-discuss mailing list
Greetings!
I have a little script that looks like below, that emails me info on my zfs
pool every day:
--- start script ---
message=`/usr/sbin/zfs list -r tank`
echo Subject: filez ZFS Information\n\n$message | mail fi...@nebol.se
--- end script ---
My problem is that when I view the mail in
Hi Johan,
storing the command output in the variable removes the newlines (or
better to say, it replaces them with spaces).
To get formatted message, you may do something like:
(
echo Subject: filez ZFS Information\n\n;
/usr/sbin/zfs list -r tank
) | mail address
Regards,
Milan Cermak
Needs quotes around $message
message=`/usr/sbin/zfs list -r tank`
echo Subject: filez ZFS Information\n\n$message | mail filez at nebol dot se
should work.
--
This message posted from opensolaris.org
___
opensolaris-discuss mailing list
On 5/3/2010 5:13 AM, Johan Eliasson wrote:
message=`/usr/sbin/zfs list -r tank`
echo Subject: filez ZFS Information\n\n$message | mail fi...@nebol.se
Impossible to read.. how can I add newlines to the email? I imagine/hope it's a
simple thing for you script-people... :)
/usr/sbin/zfs
Try this:
message=`/usr/sbin/zfs list -r tank`
echo Subject: filez ZFS Information\n\n${message}| mail filez at nebol dot se
That is curly braces around $message in the echo statement.
---ron
--
This message posted from opensolaris.org
___
Try:
= cut =
message=$( /usr/sbin/zfs list -r tank )
{
# header
printf Subject: filez ZFS Information\n\n
# message body
cat ${message}
} | mail fi...@nebol.se
= cut =
Olga
On Mon, May 3, 2010 at 8:40 PM, Ron Halstead rdhalst...@gmail.com wrote:
Try this: