[SWLUG] Capturing scrolling error messages.
Telsa Gwynne
hobbit at aloss.ukuu.org.uk
Wed Feb 8 15:06:26 UTC 2006
On Wed, Feb 08, 2006 at 03:38:23PM +0000 or thereabouts, Neil Jones wrote:
> I may have to ask this question in a more specialised forum but I get
> masses and masses of errors from
> cpan -i Image::Magick
Dunno anything about cpan, sorry, but..
> Secondly how do I stop or store the output. I have tried sending it
> though "more" this does nothing sending it to a file "> holdfile"
> doesn't work either. I just might get a clue if I could see the
> beginning of the errors before they race off the screen.
Two or three ways.
There is a command called "tee" which is like making a t-joint
(apparently) which I can never remember how to use. Despite the
fact that it's much simpler than the next one, which is...
I cannot possibly explain this clearly, but I know the result. The
reason your redirect didn't work is that "> filename" is short for
"1> filename". 1 is the standard output. This does not include
error messages. 2 is "stderr", standard error. If you want to
redirect the error messages, you need to say "2> filename". Here's
a quick demo, using an 'ls' error message.
$ ls x*
ls: x*: No such file or directory
$
If want to save that to a file, I redirect with "2>" and a filename.
$ ls x* 2> errorlog
$
Look, no mess on my screen. Now
$ cat errorlog
ls: x*: No such file or directory
$
So there. You do your cpan -i whatever and add "2> filename" on the end:
$ cpan -i whatever 2> cpan-errors
The other way is probably simpler: a command called 'script'
which I -can- remember how to use. Type "script" and you'll
get a message "Script started, file is typescript". (Or type
"script filenamehere" and you'll get "Script started, file is
filenamehere".) Now until you type "exit" or hit ^D, everything
you type at that shell or that that shell spits at you is logged.
So start script and run your command and wait until the errors
have all appeared. Then hit ^D or type "exit" and you'll get a
message saying the script has finished, and a reminder of the
filename it's all in.
'script' used to record absolutely everything except passwords,
right down to the ^Hs if you hit backspace. It doesn't seem to
be doing the control codes now, which is a great improvement!
Hope some of this helps.
Telsa
More information about the Swlug
mailing list