• document the pipeline thing better
• set -o {posix,sh} also turns off the other, like {emacs,gmacs,vi}
			
			
This commit is contained in:
		
							
								
								
									
										23
									
								
								mksh.1
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								mksh.1
									
									
									
									
									
								
							| @@ -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 $ | ||||
| .\"- | ||||
| .\" 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 | ||||
| cannot be propagated if executed in a pipeline: | ||||
| .Bd -literal -offset indent | ||||
| foo \*(Ba bar \*(Ba while read foo; do ...; done | ||||
| bar \*(Ba baz \*(Ba while read foo; do ...; done | ||||
| .Ed | ||||
| .Pp | ||||
| Use co-processes instead: | ||||
| .Bd -literal -offset indent | ||||
| foo \*(Ba bar \*(Ba& | ||||
| bar \*(Ba baz \*(Ba& | ||||
| while read \-p foo; do ...; done | ||||
| exec 3\*(Gt&p; exec 3\*(Gt&\- | ||||
| .Ed | ||||
| @@ -3913,7 +3913,9 @@ Enable a somewhat more | ||||
| ish mode. | ||||
| As a side effect, setting this flag turns off | ||||
| .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 | ||||
| Enable | ||||
| .Pa /bin/sh | ||||
| @@ -3921,11 +3923,13 @@ Enable | ||||
| mode. | ||||
| Automatically enabled if the basename of the shell invocation begins with | ||||
| .Dq sh | ||||
| and this autodetection feature was requested at compilation time | ||||
| and this autodetection feature is compiled in | ||||
| .Pq not in MirBSD . | ||||
| As a side effect, setting this flag turns off | ||||
| .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 | ||||
| Enable | ||||
| .Xr vi 1 Ns -like | ||||
| @@ -5980,6 +5984,13 @@ x=$(case $foo in bar) echo $bar ;; *) echo $baz ;; esac) | ||||
| .Pp | ||||
| Patches welcome. | ||||
| .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 | ||||
| .Nm mksh\ R39+devel | ||||
| and up, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user