[Gllug] pipe data to mail body

ben f ben_m_f at yahoo.co.uk
Fri Feb 27 16:30:57 UTC 2004

> You can run the various things you want concatenated
> in a subshell, then
> send the output from that subshell to mail, like
> this:
> -----
> (echo Subject: stuff
> echo
> head -1 $log | awk '{print $1}'
> awk -f ~/sh/myextract.awk $log
> cat ~/.sig ) | mail -s 'test' root
> -----


This was just the sort of construct I needed - thanks.

Couple of things:
1. Did you mean to put an echo in front of the "("
starting the subshell to feed it through the pipe?
I had to do this!

2. One side-effect is that the shell eats my newlines.
Is there a way to prevent the shell doing this?



Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list