• document the pipeline thing better

• set -o {posix,sh} also turns off the other, like {emacs,gmacs,vi}
This commit is contained in:
tg 2010-01-28 15:33:11 +00:00
parent 9eee6d1d6d
commit eee75716f3

23
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.213 2010/01/28 15:23:03 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.214 2010/01/28 15:33:11 tg Exp $
.\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $ .\" $OpenBSD: ksh.1,v 1.129 2009/05/28 06:09:06 jmc Exp $
.\"- .\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 .\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
@ -3591,12 +3591,12 @@ for pristine I/O.
The inner loop will be executed in a subshell and variable changes The inner loop will be executed in a subshell and variable changes
cannot be propagated if executed in a pipeline: cannot be propagated if executed in a pipeline:
.Bd -literal -offset indent .Bd -literal -offset indent
foo \*(Ba bar \*(Ba while read foo; do ...; done bar \*(Ba baz \*(Ba while read foo; do ...; done
.Ed .Ed
.Pp .Pp
Use co-processes instead: Use co-processes instead:
.Bd -literal -offset indent .Bd -literal -offset indent
foo \*(Ba bar \*(Ba& bar \*(Ba baz \*(Ba&
while read \-p foo; do ...; done while read \-p foo; do ...; done
exec 3\*(Gt&p; exec 3\*(Gt&\- exec 3\*(Gt&p; exec 3\*(Gt&\-
.Ed .Ed
@ -3913,7 +3913,9 @@ Enable a somewhat more
ish mode. ish mode.
As a side effect, setting this flag turns off As a side effect, setting this flag turns off
.Ic braceexpand .Ic braceexpand
mode, which can be turned back on manually. mode, which can be turned back on manually, and
.Ic sh
mode.
.It Ic sh .It Ic sh
Enable Enable
.Pa /bin/sh .Pa /bin/sh
@ -3921,11 +3923,13 @@ Enable
mode. mode.
Automatically enabled if the basename of the shell invocation begins with Automatically enabled if the basename of the shell invocation begins with
.Dq sh .Dq sh
and this autodetection feature was requested at compilation time and this autodetection feature is compiled in
.Pq not in MirBSD . .Pq not in MirBSD .
As a side effect, setting this flag turns off As a side effect, setting this flag turns off
.Ic braceexpand .Ic braceexpand
mode, which can be turned back on manually. mode, which can be turned back on manually, and
.Ic posix
mode.
.It Ic vi .It Ic vi
Enable Enable
.Xr vi 1 Ns -like .Xr vi 1 Ns -like
@ -5980,6 +5984,13 @@ x=$(case $foo in bar) echo $bar ;; *) echo $baz ;; esac)
.Pp .Pp
Patches welcome. Patches welcome.
.Pp .Pp
The parts of a pipeline, like below, are executed in subshells.
Thus, variable assignments inside them fail.
This is actually a feature; use co-processes instead.
.Bd -literal -offset indent
foo \*(Ba bar \*(Ba read baz # will not change $baz
.Ed
.Pp
This document attempts to describe This document attempts to describe
.Nm mksh\ R39+devel .Nm mksh\ R39+devel
and up, and up,