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