bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: order of redirections


From: pk
Subject: Re: order of redirections
Date: Mon, 02 Mar 2009 23:43:16 +0100

On Monday 2 March 2009 23:34, lehe wrote:

> 
> Hi,
> I have some questions about the paragraph in Bash Reference on
> redirections: "Note that the order of redirections is significant. For
> example, the command
>       ls > dirlist 2>&1
> directs both standard output (file descriptor 1) and standard error (file
> descriptor 2) to the
> file dirlist, while the command
>       ls 2>&1 > dirlist
> directs only the standard output to file dirlist, because the standard
> error was duplicated
> as standard output before the standard output was redirected to dirlist."
> 
> In the first example "ls > dirlist 2>&1", does it mean first "ls >
> dirlist" and then "2>&1"? If yes, then dirlist will not have the content
> of standard error 2.
> 
> In the second example "ls 2>&1 >dirlist", does it mean "ls 2>&1" and then
> ">dirlist" where 1 is omit as default before >?

http://bash-hackers.org/wiki/doku.php?id=howto:redirection_tutorial



reply via email to

[Prev in Thread] Current Thread [Next in Thread]