Module Name: src Committed By: kre Date: Fri Sep 16 19:25:10 UTC 2022
Modified Files: src/bin/sh: sh.1 Log Message: More wording improvements. There might be more to come. To generate a diff of this commit: cvs rdiff -u -r1.248 -r1.249 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.248 src/bin/sh/sh.1:1.249 --- src/bin/sh/sh.1:1.248 Fri Sep 16 17:32:18 2022 +++ src/bin/sh/sh.1 Fri Sep 16 19:25:09 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: sh.1,v 1.248 2022/09/16 17:32:18 kre Exp $ +.\" $NetBSD: sh.1,v 1.249 2022/09/16 19:25:09 kre Exp $ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -885,7 +885,8 @@ built-in command. Whenever a reserved word (see above) may occur, and after checking for reserved words, the shell checks the word to see if it matches an alias. -If it does, it replaces it in the input stream with its value. +If it does, the alias word is replaced by its value in the input stream, +as if the value had been entered instead. For example, if there is an alias called .Dq lf with the value @@ -936,7 +937,8 @@ command is located. Any remaining words are considered the arguments of the command. If no command name resulted, then the .Dq Ar name Ns Li = Ns Ar value -variable assignments recognized in item 1 affect the current shell. +variable assignments recognized in item 1 affect the current shell, +but are not automatically added to the environment (are not exported). .It Redirections are performed, from first to last, in the order given, as described in the next section. @@ -968,6 +970,11 @@ that refers to a file descriptor. If present it must occur unquoted, immediately before the redirection operator, with no intervening white space, and becomes a part of that operator. +If not explicitly present, +.Ar n +will be 0 (standard input) +or 1 (standard output) +depending upon the redicection operator used. If file descriptor .Ar n was open prior to the redirection, its previous use is closed. @@ -1117,7 +1124,7 @@ are set to the arguments of the shell fu The variables which are explicitly placed in the environment of the command (by placing assignments to them before the function name) are made local to the function and are set to the values given, -and exported for the benefit of programs executed with the function. +and exported for the benefit of programs executed within the function. Then the command given in the function definition is executed. The positional parameters, and local variables, are restored to their original values when the command completes. @@ -1300,9 +1307,10 @@ sends both the standard output and stand to the standard input of command2. .Pp Note that unlike some other shells, each process in the pipeline is a -child of the invoking shell (unless it is a shell built-in, in which case -it executes in the current shell \(em but any effect it has on the -environment is wiped). +child of the invoking shell, except in the case where the pipeline +is a single simple command (no +.Sq Ic \(ba +characters appear.) .Pp A pipeline is a simple case of an AND-OR-list (described below.) A @@ -1742,11 +1750,14 @@ The value of the parameter is listed nex .It Dv * Expands to the positional parameters, starting from one. When the -expansion occurs within a double-quoted string it expands to a single +expansion occurs in a situation where field splitting is never +performed, such as within a double-quoted string, it expands to a single field with the value of each parameter separated by the first character of the .Ev IFS -variable, or by a +variable (possibly nothing if +.EV IFS +has a null value), or by a .Aq space if .Ev IFS @@ -1755,6 +1766,13 @@ is unset. Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each positional parameter expands as a separate argument. +If the expansion happens in other situations where field splitting +is not performed, whether double quoted or not, the results are undefined. +In most shells, including this one, +.Dv \&$@ +is treated as +.Dv \&$* +in such a context, but this is not universally true. If there are no positional parameters, the expansion of @ generates zero arguments, even when .Dv $@ @@ -1831,8 +1849,8 @@ instances of the expansion, or any of th Unless the .Ev IFS variable has an empty value, -Field Splitting is performed on fields -generated by step (1) except for Tilde Expansion. +Field Splitting is performed on the text resulting from +the expansions in step (1) except for Tilde Expansion. .It Pathname Expansion (unless set .Fl f