Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 072010

How to redirect error message to a file


Assume you have some program/script that print to the standard error stream (i.e. stderr)


print STDERR 'error';

You cannot redirect the error message just by basic file redirection, e.g.

perl > error.txt

Instead, you need to use 2>

perl 2> error.txt

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>