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

Re: capturing output of a script requiring answers to prompts



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..



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