[mythtv-users] Redirecting output (was Re: OT: Mount problems)

Robin Hill myth at robinhill.me.uk
Sun Nov 30 11:53:18 UTC 2008


On Sun Nov 30, 2008 at 02:36:14AM -0500, MailingListJ wrote:

> Michael T. Dean wrote:
> >
> > command > /path/to/file 2>&1
> >   
> whats the 2>&1 do?
> 
A standard application has access to two separate output streams (both
of which will print to screen by default):
    1: STDOUT (standard output) - used for reporting results
    2: STDERR (standard error) - used for reporting errors

When you run  "command > file" it just redirects the first (STDOUT)
output stream.  In most cases that's what you want, as that contains the
main output of the program, without any extra debug messages, etc.

However, in some cases you do want the error messages as well, so the
2>&1 tells it to redirect the second output stream (STDERR) to the first
(STDOUT).  This means all the output will go to the same place - in this
case, the file.

HTH,
    Robin
-- 
     ___        
    ( ' }     |       Robin Hill        <myth at robinhill.me.uk>  |
   / / )      | Little Jim says ....                            |
  // !!       |      "He fallen in de water !!"                 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20081130/4f50343a/attachment-0001.pgp 


More information about the mythtv-users mailing list