2010/11/22 Roshan kubunturos@gmail.com:
So effectively, whenever, we are redirecting to STDOUT or STDERR, the command (process) that is executed, its output or error is put into a file. Anytime, the input for bash fails (via file through < operator), the subsequent STDOUT and STDERR are reverted to usual (the terminal) [even if appeared to be changed in the actual command].
Bash will process the command line left-to-right for redirections. So, you will see different behaviour depending on whether you run:
cat < foo 2> err or cat 2> err < foo
That also explains the differing behaviours of:
ls -ld /tmp /nonexistent > /tmp/output 2>&1 and ls -ld /tmp /nonexistent 2>&1 > /tmp/output
Also: the '<' redirection for input is for the command that bash runs, not for bash itself (but see the documentation of the "exec" bash builtin).
Binand