[plug] saving screen output

Leon Brooks leon at brooks.fdns.net
Tue Feb 22 20:48:30 WST 2005


On Tuesday 22 February 2005 20:26, Russ Pitman wrote:
> I need to save the output of a command to a file so it can be
> included/attached to an email message.

Be aware that there are two commonly used output streams, stdout (normal 
stuff, fd #1) and stderr (errors, #2) and one input, stderr (#0). Read 
up on stdaux and stdprn if you're curious about the others.

> The command is 'exim -d -bt xxxxan at westnet.com.au' which produces
> approx two pages of output.

> Running the above with '< eximcmd' appended generates a file
> 'eximcmd' containing just two lines of text ?

That would be '> eximcmd'; but what you really wanted was:

    exim -d -bt xxxxan at westnet.com.au &> eximcmd

This captures stderr as well. You could do the same thing with:

    exim -d -bt xxxxan at westnet.com.au 2>&1 > eximcmd

This says "send stderr to the same place as stdout" then "jam stdout 
into a file called eximcmd".

Type man:bash into Konqueror one day. You'll be amazed. (-:

Cheers; Leon



More information about the plug mailing list