Document that a N>&N (or N<&N) redirection turns off close-on-exec for N
(where N is a decimal fd number) either when used as some-command N>&N (where fd N is passed, open, to some-command - which is obviously what is wanted) Or as exec N>&N which effects fd N for all future commands. Note that this means exec N>foo N>&N returns to the old behaviour of leaving the file descriptor open when commands are run (as do most shells, other than ksh) and works for both new and old NetBSD shells (old ones never set close-on-exec, and treat N>&N as a rather meaingless no-op request, and just ignore it), new ones set close-on-exec on the first redirection, then disable it again on the second. Everything here about >& for output fds applies to <& for input ones. OK christos@
This commit is contained in:
parent
1755d8e4a6
commit
f112b7e1a3
12
bin/sh/sh.1
12
bin/sh/sh.1
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: sh.1,v 1.122 2016/05/09 20:36:07 kre Exp $
|
||||
.\" $NetBSD: sh.1,v 1.123 2016/05/12 13:15:43 kre Exp $
|
||||
.\" Copyright (c) 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
|
@ -1538,6 +1538,16 @@ Traditionally Bourne-like shells
|
|||
(except
|
||||
.Xr ksh 1 ) ,
|
||||
made those file descriptors available to exec'ed processes.
|
||||
To turn off the close-on-exec mark,
|
||||
redirect the descriptor to (or from) itself,
|
||||
either when invoking a command for which the descriptor is wanted open,
|
||||
or by using
|
||||
.Ic exec
|
||||
(perhaps the same
|
||||
.Ic exec
|
||||
as opened it, after the open)
|
||||
to leave the descriptor open in the shell
|
||||
and pass it to all commands invoked subsequently.
|
||||
.It exit Op Ar exitstatus
|
||||
Terminate the shell process.
|
||||
If
|
||||
|
|
Loading…
Reference in New Issue