tee is used to send output from a command to both
STDOUT and to a file. You can also use tee to send output to
STDOUT and pass the output on to another command like you would normally using a
pipe. This uses a process substitution syntax.
~$ echo "some error message" | tee >(logger -t test_error_msg) some error message ~$ grep test_error_msg /var/log/syslog Feb 24 11:37:54 foohost test_error_msg: some error message ~$
The error message is output to
STDOUT and also sent to the
logger command (which writes it to syslog). This can be usefull when you have silent cron jobs (>/dev/null 2>&1) that log errors to syslog, but at the same time if you run the shell script by hand you can see the error output.