From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6354 invoked by alias); 1 Feb 2011 23:42:06 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15756 Received: (qmail 4779 invoked from network); 1 Feb 2011 23:41:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at benizi.com designates 64.130.10.15 as permitted sender) Date: Tue, 1 Feb 2011 18:41:26 -0500 (EST) From: "Benjamin R. Haskell" To: Zsh Users Subject: Tee all output to log file? Message-ID: User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII 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