mail command
Hi there,
I want to send and email what ever the command out put i see in the console. for example: ls -al | tee out; cat out | mail test@bla.com this will work but is there any better way ? |
ls -la | mail test@bla.com ;)
|
sorry for not being clear on the question. I also want to see the out put on the screen before it sends an email.
|
Oh, ok.
In that case your command sequence looks ok. You could do without the "out; cat out" part and pipe the output of tee directly into mail. However, if you want to be able to abort sending the mail, after inspecting the output how about defining an alias like show_n_mail (or something shorter so you don't have to type so much: alias show_n_mail='tee /tmp/out; echo "Send mail? [y/n]"; read ans; if [ $ans == "y" ]; then cat /tmp/out | mail test@bla.com; fi; rm /tmp/out' Then you can just pipe any input into show_n_mail: df -h|show_n_mail |
All times are GMT -5. The time now is 12:58 PM. |