Module Name: src Committed By: uwe Date: Tue Mar 13 19:43:52 UTC 2018
Modified Files: src/bin/sh: sh.1 Log Message: .Dl is a a single line .Bd -literal -offset indent so don't abuse multiple consecutive .Dl and use proper .Bd instead. To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/bin/sh/sh.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/sh.1 diff -u src/bin/sh/sh.1:1.177 src/bin/sh/sh.1:1.178 --- src/bin/sh/sh.1:1.177 Tue Mar 13 19:35:46 2018 +++ src/bin/sh/sh.1 Tue Mar 13 19:43:52 2018 @@ -1,4 +1,4 @@ -.\" $NetBSD: sh.1,v 1.177 2018/03/13 19:35:46 uwe Exp $ +.\" $NetBSD: sh.1,v 1.178 2018/03/13 19:43:52 uwe Exp $ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -1410,18 +1410,27 @@ function is called. This means that a simple .Dq Hello World function might be written (in the extended syntax) as: -.Dl hello() cat <<EOF -.Dl Hello World! -.Dl EOF +.Bd -literal -offset indent +hello() cat <<EOF +Hello World! +EOF +.Ed +.Pp To be correctly standards conforming this should be re-written as: -.Dl hello() { cat; } <<EOF -.Dl Hello World! -.Dl EOF +.Bd -literal -offset indent +hello() { cat; } <<EOF +Hello World! +EOF +.Ed +.Pp Note the distinction between those forms, and -.Dl hello() { cat <<EOF -.Dl Hello World! -.Dl EOF -.Dl \&} +.Bd -literal -offset indent +hello() { cat <<EOF +Hello World! +EOF +\&} +.Ed +.Pp which reads and processes the .Ic here document each time the shell executes the function, and which applies @@ -2181,8 +2190,11 @@ to a single command, script or function command invocation by a variable assignment to that variable, provided the variable is not also read-only. That is -.Dl export -x FOO ; # FOO will now not be exported by default -.Dl FOO=some_value my_command +.Bd -literal -offset indent +export -x FOO # FOO will now not be exported by default +FOO=some_value my_command +.Ed +.Pp still passes the value (FOO=some_value) to .Ic my_command through the environment.