brain-dead tee question

hello all -

i have a chain of commands. i wish to display the results in the middle. i thought 'tee' would do it, but then i realized that tee is primary used to write to a file.

so, for example, suppose i have this:

date | mail -s 'hot date for mark' ;

i want to not only see the date, but i want to mail the date to me.

there is something out there called "named pipes" but i have never tried it.


Staff member
Not sure I understand

Perhaps you want


echo -e "Hello, Mark\nThe date of the server is $date\n" | mail -s "hot date for mark"
you are close. i would like the results of your first echo command to show up in STDOUT in addition to being send to the mail command.

sorta like this:

date=$(date) ; ### backticks are depreciated ;-))
echo $date ;
echo 'mark needs a date' $date | mail -s 'hot date for mark' ;

see the pair of echo's ? i should think there would be a way to do this. and i would think we would not have to use env variables to do this.

this is the unix world, after all !


Staff member
Tee can out put and send to file, but then you need to mail the file (and remove it)
ahh well i was ultimately trying to comb my apache logs for attack attempts., so i suppose i could "tee -a" into the csf.deny file.

but to my original question i thought maybe john Q might have a cool named pipe example, something i have never used.