October 16th, 2013, 04:32 PM
Std output & std error
What is the point of std errors? If I know there is an error then I avoid it. Why should I want to "redirect" it to another file?
I am sure I am missing a point here. So can someone give a "real" example?
root@behnam:~# lasdasdasds >> file 2> error
October 16th, 2013, 05:28 PM
By convention, stdout is for normal output from a program and stderr is for error output. That way you can separate the two if needs be.
Example: a cron job. Normally the output from cron will be emailed to you. If your program outputs normal messages then you probably don't care about them, but if it outputted errors then you would care about those.
Or maybe you're running some sort of processing script that generates a lot of output (which you want) but possibly some errors (which you definitely want). Normally you'd get a lot of output at once and it'd be difficult to sift through it while trying to locate error messages, or you can
and look through both log files at your leisure.
/path/to/program >output.log 2>error.log
October 16th, 2013, 06:41 PM
Thanks, getting into cronjob with mysqldump. I guess I will run into this then.
Originally Posted by requinix
October 16th, 2013, 07:52 PM
STDERR is commonly used for status information too. For example if you're downloading a file the progress bar indicating the download status would be printed on STDERR, while the file contents would be printed on STDOUT. With the separate streams, you could redirect STDOUT to a file (or pipe it to a process) while still being able to see the progress bar for the download.
Recycle your old CD's, don't just trash them
If I helped out out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud