The title might be vague, but I have a good example:
echo "Test message:\nThis is a line.\nAnd this is another." | nail -s "`tail -1`" joe@localhost
The objective here is to send the content of the echo as the message body and using the last line as the subject. However, when I do this, I lose the body.
echo "Test message:\nThis is a line.\nAnd this is another." | nail joe@localhost
Works fine, but there is no subject.
You could do it with a named pipe, this works here:
Note if you use head instead of tail, you need to make
teeignoreSIGPIPEsignals, e.g.trap '' PIPE.