On Monday 27 Oct 2003 1:41 am, Fajar Priyanto wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Dear All, > I want to do some bash commands and then send the results by email from > CLI, can I do that? > > I tried this but didn't work: > [EMAIL PROTECTED] Documents]# df > /home/fajar/Documents/df | mail -I -s df > [EMAIL PROTECTED] ~r /home/fajar/Documents/df > Null message body; hope that's ok > > Seems that ~r option only works in the body of the message.
It looks like you're being too complex: df | mail -s test richard sent me: ------------------------------------------------------------- Return-Path: <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: test From: [EMAIL PROTECTED] (Richard Urwin) Filesystem Size Used Avail Use% Mounted on /dev/hda1 20G 132M 20G 1% / /dev/hda6 3.9G 2.5M 3.7G 1% /boot /dev/hdb1 8.6G 6.0G 2.6G 70% /home /dev/hda8 16G 33M 16G 1% /testroot /dev/hda7 98G 2.0G 96G 3% /usr /dev/hda9 13G 134M 12G 2% /var ------------------------------------------------------------- and then: echo hello world > test mail -s another richard < test sent me: ------------------------------------------------------------- To: [EMAIL PROTECTED] Subject: another From: [EMAIL PROTECTED] (Richard Urwin) hello world ------------------------------------------------------------- And then: df | mail -s "`echo \`hostname\` disk space report`" richard sent me ------------------------------------------------------------- To: [EMAIL PROTECTED] Subject: mercury.soronlin.org.uk disk space report From: [EMAIL PROTECTED] (Richard Urwin) Filesystem Size Used Avail Use% Mounted on /dev/hda1 20G 132M 20G 1% / /dev/hda6 3.9G 2.5M 3.7G 1% /boot /dev/hdb1 8.6G 6.0G 2.6G 70% /home /dev/hda8 16G 33M 16G 1% /testroot /dev/hda7 98G 2.0G 96G 3% /usr /dev/hda9 13G 135M 12G 2% /var ------------------------------------------------------------- -- Richard Urwin
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com