Tive a necessidade de criar um script shell que ao mesmo tempo que fosse dando echo na tela também fosse armazenando isso em um arquivo de log.
Achei na net esse exemplo:
#!/bin/sh
# whatis: Demo script that prints to both screen and a file
{
echo
Logging demo
echo
Output will go both the
screen
and logging.log
# Other lines which might produce output here
} |
tee
logging.log
O artigo completo esta em:
http://wuhrr.wordpress.com/2011/01/11/bash-log-to-screen-and-file-simultaneously/
É isso!