The Gyzmo <[EMAIL PROTECTED]> writes: > Why do you have to put '2>&1' after '/dev/null' when > piping something to /dev/null, like this:? > > [command] > /dev/null 2>&1
You only need that to capture any output on file descriptor 2 (stderr) a simple `some_command > file' only redirects file descriptor 1 (stdout) So any error output will not go to `file' With bash you could run this experiment to see the difference: First make sure there are no file a_file or b_file Then: touch a_file ls a_file > out cat out a_file ls b_file >out ls: b_file: No such file or directory (The `No such ..' part is on stderr and goes to tty not out) cat out <nothing> Now try it with `ls b_file > out 2>&1' cat out ls: b_file: No such file or directory That time both file desciptor 1 and 2 were redirected to `out' _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list