in reply to Re^4: how to supress stdout
in thread how to supress stdout

Aren't fd 1 and 2 stdout and stderr by definition?

Replies are listed 'Best First'.
Re^6: how to supress stdout
by parv (Parson) on Dec 14, 2008 at 09:41 UTC

    Yes, they are.

    As for the assumption in "Assuming 1 is standard output ...", if fd's 1 & 2 have been already closed & opened to some other fd's (before redirection), would fd's 1 & 2 still work for the purpose (of redirection after being redirected)?

      I don't see why > would depend on the previous state of the file descriptors. If the fd is closed, > should reopen it.

      And that's what I see happening:

      $ ( echo foo ) 1>&- -bash: echo: write error: Bad file descriptor $ ( echo foo > /dev/tty ) 1>&- foo