Op 27-04-18 om 23:38 schreef Stephane Chazelas:
2018-04-27 20:28:57 +0200, Martijn Dekker:
[...]
: <&8 || echo "oops, closed"
[...]

Remember ":" is a special builtin, so its failure causes the
shell to exit. Another one of those accidents of implementation
of the Bourne shell that ended up being specified by POSIX, but
which makes little sense (but that other shells ended up
implementing for conformance).

Good point. Ignore the '|| echo "oops, closed"', it's pointless because a failed direction prints an error message anyway. I should have said that no shell produces an error there.

That said, do you have any opinion on whether something like
   { ... ; } 3>&-
should push/restore a closed file descriptor if it's already closed, so that the effect of exec-ing that descriptor within the compound command is local to that compound command?

- M.

Reply via email to