Inputs and outputs in the right order

CyberLeo Kitsana cyberleo at cyberleo.net
Fri Nov 1 15:27:06 UTC 2013


On 10/31/2013 09:56 PM, Martin McCormick wrote:
<snip>
> 	I know that expect does a great job of logging a session
> but I am wondering if there is an easier way to get the shell
> input echoed interwoven with all the output. In shorter words,
> what is the easiest way to produce a session log that reads like
> what actually happened when it happened?

In bourne-compatible shells (/bin/sh, bash) run 'set -x' or pass the -x
flag during invocation to turn on debug output. The shell will print out
each command it is about to invoke.

The output requires some interpretation, as it can get confusing in the
presence of variable expansion, pipelines, and subshells; but it should
be adequate for a simple list of commands.

-- 
Fuzzy love,
-CyberLeo
Technical Administrator
CyberLeo.Net Webhosting
http://www.CyberLeo.Net
<CyberLeo at CyberLeo.Net>

Furry Peace! - http://www.fur.com/peace/


More information about the freebsd-questions mailing list