Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Tee all output to log file?



For scripting purposes I occasionally want a way to both record and display all the output of a script. On several occasions now, I've looked through the output redirection section of the manual, but I never come up with quite what I'm looking for.

Essentially, when I want this, I usually want something like:

#!/bin/zsh
(( $+logfile )) && exec |& tee $logfile

Boiled down even further, it's really just this I'm looking for:
exec |& tee logfile

Is there something straightforward that I'm overlooking? Is there a commonly used utility for this? (`script` comes to mind, but I recall klunkiness when trying it in the past.)

--
Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author