From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28307 invoked from network); 18 Jul 2005 18:27:35 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Jul 2005 18:27:35 -0000 Received: (qmail 77505 invoked from network); 18 Jul 2005 18:27:28 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Jul 2005 18:27:28 -0000 Received: (qmail 12223 invoked by alias); 18 Jul 2005 18:27:21 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9105 Received: (qmail 12214 invoked from network); 18 Jul 2005 18:27:21 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 18 Jul 2005 18:27:21 -0000 Received: (qmail 76582 invoked from network); 18 Jul 2005 18:27:20 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO dot.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 18 Jul 2005 18:27:15 -0000 Received: by dot.blorf.net (Postfix, from userid 1000) id E05654CB; Mon, 18 Jul 2005 11:27:14 -0700 (PDT) Date: Mon, 18 Jul 2005 11:27:14 -0700 From: Wayne Davison To: zzapper Cc: zsh-users@sunsite.dk Subject: Re: capturing output of a script requiring answers to prompts Message-ID: <20050718182714.GB19066@blorf.net> References: <5c9nd157fcj924v4fdcjlesm9fvq7c5lb6@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5c9nd157fcj924v4fdcjlesm9fvq7c5lb6@4ax.com> User-Agent: Mutt/1.5.9i X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=ham version=3.0.4 On Mon, Jul 18, 2005 at 01:52:51PM +0100, zzapper wrote: > How can I capture the output of a script requiring answers to prompts. The best way to capture the full output of an interactive session is using the "script" utility (which comes with most unix-like operating systems): script output.txt That requires you to run your SCRIPT-FILE from inside the subshell and then "exit". Alternately, if your version of "script" is new enough: script -c ./SCRIPT-FILE output.txt The zsh-specific way to output data to both the terminal and a file is to use multi-IO: ./SCRIPT-FILE >&1 >output.txt However, that doesn't capture what the user types. ..wayne..