bug-bash
[Top][All Lists]
Advanced

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

order of redirections


From: lehe
Subject: order of redirections
Date: Mon, 2 Mar 2009 14:34:17 -0800 (PST)

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 >?

-- 
View this message in context: 
http://www.nabble.com/order-of-redirections-tp22298397p22298397.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.





reply via email to

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