Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh More wording improvements. There might be more to c...
details: https://anonhg.NetBSD.org/src/rev/65482ab52bb9
branches: trunk
changeset: 370096:65482ab52bb9
user: kre <kre%NetBSD.org@localhost>
date: Fri Sep 16 19:25:09 2022 +0000
description:
More wording improvements. There might be more to come.
diffstat:
bin/sh/sh.1 | 40 +++++++++++++++++++++++++++++-----------
1 files changed, 29 insertions(+), 11 deletions(-)
diffs (106 lines):
diff -r 4ad990a20d3b -r 65482ab52bb9 bin/sh/sh.1
--- a/bin/sh/sh.1 Fri Sep 16 17:32:18 2022 +0000
+++ b/bin/sh/sh.1 Fri Sep 16 19:25:09 2022 +0000
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
.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 @@
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 @@
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
Home |
Main Index |
Thread Index |
Old Index