1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

manual: use consistent terminology

The ksh manual page is one of the few places that calls globbing
"file name generation". The mksh and zsh manuals use the same term.
But every other shell's manual calls it "pathname expansion": bash,
dash, yash, FreeBSD sh. So does ksh's built-in documentation (alias
--man, export --man, readonly --man, set --man, typeset --man).
What's more, the authoritative ksh reference, Bolsky & Korn's 1995
"The New Kornshell" book, also calls it "pathname expansion", and
so does the POSIX standard.

Similarly, "arithmetic substitution" should be called "arithmetic
expansion" per Bolsky & Korn as well as POSIX.

This commit has several other miscellaneous documentation tweaks as
well.
This commit is contained in:
Martijn Dekker 2021-11-19 02:49:28 +01:00
parent bd9752e43c
commit 15bbc2f632
6 changed files with 59 additions and 45 deletions

View file

@ -14,7 +14,7 @@ For more details, see the NEWS file and for complete details, see the git log.
1. Bytecode compiled by shcomp 93u+m will not run on older ksh versions. 1. Bytecode compiled by shcomp 93u+m will not run on older ksh versions.
(However, bytecode compiled by older shcomp will run on ksh 93u+m.) (However, bytecode compiled by older shcomp will run on ksh 93u+m.)
2. File name generation (a.k.a. pathname expansion, a.k.a. globbing) now 2. Pathname expansion (a.k.a. filename generation, a.k.a. globbing) now
never matches the special navigational names '.' (current directory) never matches the special navigational names '.' (current directory)
and '..' (parent directory). This change makes a pattern like .* and '..' (parent directory). This change makes a pattern like .*
useful; it now matches all hidden 'dotfiles' in the current directory. useful; it now matches all hidden 'dotfiles' in the current directory.

View file

@ -109,7 +109,7 @@ sh directory:
5. deparse.c contains code to generate shell script from 5. deparse.c contains code to generate shell script from
a parse tree. a parse tree.
6. expand.c contains code for file name expansion and 6. expand.c contains code for file name expansion and
file name generation. pathname expansion.
7. fault.c contains code for signal processing, trap 7. fault.c contains code for signal processing, trap
handling and termination. handling and termination.
8. fcin.c contains code for reading and writing a character 8. fcin.c contains code for reading and writing a character

View file

@ -95,7 +95,7 @@ way scripts are.
Substring Capabilities: KSH-93 allows you to create a Substring Capabilities: KSH-93 allows you to create a
substring of any given string either by specifying the starting substring of any given string either by specifying the starting
offset and length, or by stripping off leading offset and length, or by stripping off leading
or trailing substrings during parameter substitution. or trailing substrings during parameter expansion.
You can also specify attributes, such as upper and lower case, You can also specify attributes, such as upper and lower case,
field width, and justification to shell variables. field width, and justification to shell variables.
.LI .LI
@ -137,5 +137,5 @@ be embedded into an application to allow scripting.
Documentation for KSH-93 consists of an "Introduction to KSH-93", Documentation for KSH-93 consists of an "Introduction to KSH-93",
"Compatibility with the Bourne Shell" and a manual page and a "Compatibility with the Bourne Shell" and a manual page and a
README file. In addition, the "New KornShell Command and Programming README file. In addition, the "New KornShell Command and Programming
Language," book is available from Prentice Hall. Language" book is available from Prentice Hall.

View file

@ -39,7 +39,8 @@ The options have the following defaults and meanings:
the job pid and $? is set to the job exit status at the the job pid and $? is set to the job exit status at the
beginning of the trap. beginning of the trap.
BRACEPAT on C-shell type abc{d,e}f style file generation BRACEPAT on Brace expansion. Expands abc{d,e}f to abcdf abcef.
This feature was inspired by the C shell.
CMDLIB_HDR "<cmdlist.h>" CMDLIB_HDR "<cmdlist.h>"
The header in which you can provide a custom list of The header in which you can provide a custom list of
@ -79,7 +80,7 @@ The options have the following defaults and meanings:
fixed-size arrays NAME[N1][N2]... are also supported. fixed-size arrays NAME[N1][N2]... are also supported.
GLOBCASEDET Adds the 'globcasedetect' shell option. When this shell GLOBCASEDET Adds the 'globcasedetect' shell option. When this shell
option is turned on, file name generation (globbing) option is turned on, pathname expansion (globbing)
and file name listing and completion automatically become and file name listing and completion automatically become
case-insensitive on file systems where the difference case-insensitive on file systems where the difference
between upper- and lowercase is ignored for file names. between upper- and lowercase is ignored for file names.
@ -95,8 +96,15 @@ The options have the following defaults and meanings:
MULTIBYTE on Multibyte character handling. Requires mblen() and MULTIBYTE on Multibyte character handling. Requires mblen() and
mbctowc(). mbctowc().
NAMESPACE on Allows namespaces. This is experimental, incomplete NAMESPACE on Adds a 'namespace' reserved word that allows defining name
and undocumented. spaces. Variables and functions defined within a block like
namespace ExampleSpace { commandlist; }
all have their names automatically prefixed with
'.ExampleSpace.' when defining or using them, creating a
separate space of names unique to the block. Outside of
the namespace block, they can be accessed using
.ExampleSpace.function or ${.ExampleSpace.variable}.
Name spaces within name spaces are also supported.
NOECHOE off Disable the '-e' option to the 'echo' command, NOECHOE off Disable the '-e' option to the 'echo' command,
unless SHOPT_ECHOPRINT is enabled. unless SHOPT_ECHOPRINT is enabled.

View file

@ -63,8 +63,8 @@ const char sh_opttest[] =
"[+DESCRIPTION?\btest\b evaluates expressions and returns its result using the " "[+DESCRIPTION?\btest\b evaluates expressions and returns its result using the "
"exit status. Option parsing is not performed; all arguments, " "exit status. Option parsing is not performed; all arguments, "
"including \b--\b, are processed as operands. It is essential to quote " "including \b--\b, are processed as operands. It is essential to quote "
"expression arguments to suppress empty removal, field splitting, file " "expression arguments to suppress empty removal, field splitting, "
"name generation, and constructs such as redirection. If the command " "pathname expansion, and constructs such as redirection. If the command "
"is invoked as \b[\b, a final \b]]\b argument is required and " "is invoked as \b[\b, a final \b]]\b argument is required and "
"discarded. The evaluation of the expression depends on the number of " "discarded. The evaluation of the expression depends on the number of "
"operands, as follows:]" "operands, as follows:]"

View file

@ -416,8 +416,8 @@ that matches
.IR word . .IR word .
The form of the patterns is The form of the patterns is
the same as that used for the same as that used for
file name generation (see pathname expansion (see
.I "File Name Generation\^" .I "Pathname Expansion\^"
below). below).
The The
.B ;; .B ;;
@ -706,7 +706,7 @@ value is not unset and the new values are appended to the
current ones provided that the types are compatible. current ones provided that the types are compatible.
.PP .PP
The right hand side of a variable assignment undergoes all the expansion The right hand side of a variable assignment undergoes all the expansion
listed below except word splitting, brace expansion, and file name generation. listed below except word splitting, brace expansion, and pathname expansion.
When the left hand side is an assignment is a compound variable and When the left hand side is an assignment is a compound variable and
the right hand is the name of a compound variable, the compound variable the right hand is the name of a compound variable, the compound variable
on the right will be copied or appended to the compound variable on the left. on the right will be copied or appended to the compound variable on the left.
@ -911,7 +911,7 @@ side effects are possible.
For the second form, the final For the second form, the final
.B } .B }
will be recognized as a reserved word after any token. will be recognized as a reserved word after any token.
.SS Arithmetic Substitution. .SS Arithmetic Expansion.
An arithmetic expression enclosed in double An arithmetic expression enclosed in double
parentheses preceded by a dollar sign ( parentheses preceded by a dollar sign (
.B $((\|)) .B $((\|))
@ -1851,7 +1851,7 @@ will be turned on.
.SM .SM
.B ENV .B ENV
If this variable is set, then If this variable is set, then
parameter expansion, command substitution, and arithmetic substitution parameter expansion, command substitution, and arithmetic expansion
are performed on are performed on
the value to generate the value to generate
the pathname of the script that will be the pathname of the script that will be
@ -1966,7 +1966,7 @@ The first character of the
variable is used to separate arguments for the variable is used to separate arguments for the
.B .B
"$*" "$*"
substitution (see expansion (see
.I Quoting .I Quoting
below). below).
Each single occurrence of Each single occurrence of
@ -2037,7 +2037,7 @@ collation information.
This variable determines the locale category for character This variable determines the locale category for character
handling functions. handling functions.
It determines the character classes for pattern matching (see It determines the character classes for pattern matching (see
.I "File Name Generation\^" .I "Pathname Expansion\^"
below). below).
.TP .TP
.B .B
@ -2099,7 +2099,7 @@ Each file name can be followed by a
.B ? .B ?
and a message that will be printed. and a message that will be printed.
The message will undergo parameter expansion, command substitution, The message will undergo parameter expansion, command substitution,
and arithmetic substitution and arithmetic expansion
with the variable with the variable
.B $_ .B $_
defined as the name of the file that has changed. defined as the name of the file that has changed.
@ -2125,7 +2125,7 @@ if executing under
Every time a new command line is started on an interactive shell, Every time a new command line is started on an interactive shell,
the value of this variable is expanded to resolve the value of this variable is expanded to resolve
backslash escaping, parameter expansion, command substitution, backslash escaping, parameter expansion, command substitution,
and arithmetic substitution. and arithmetic expansion.
The result defines the primary prompt string for that command line. The result defines the primary prompt string for that command line.
The default is The default is
.RB `` "$ \|\|\|" ''. .RB `` "$ \|\|\|" ''.
@ -2164,7 +2164,7 @@ loop, by default
.SM .SM
.B PS4 .B PS4
The value of this variable is expanded for parameter evaluation, The value of this variable is expanded for parameter evaluation,
command substitution, and arithmetic substitution command substitution, and arithmetic expansion
and precedes each line of an execution trace. and precedes each line of an execution trace.
By default, By default,
.SM .SM
@ -2450,7 +2450,9 @@ expands to the 8 fields,
.B z04bx .B z04bx
and and
.BR z04cx . .BR z04cx .
.SS File Name Generation. .SS Pathname Expansion.
This is also known as \f2globbing\fP
or sometimes \f2filename generation\fP.
Following splitting, each field is scanned for the characters Following splitting, each field is scanned for the characters
.BR * , .BR * ,
.BR ? , .BR ? ,
@ -2761,7 +2763,7 @@ This is the default.
.TP .TP
.B N .B N
This is ignored. However, when it is the first letter and is This is ignored. However, when it is the first letter and is
used with file name generation, and no matches occur, used with pathname expansion, and no matches occur,
the file pattern expands to the empty string. the file pattern expands to the empty string.
.TP .TP
.B X .B X
@ -2911,13 +2913,17 @@ The recognition of function names or built-in command names listed below
cannot be altered by quoting them. cannot be altered by quoting them.
.SS Arithmetic Evaluation. .SS Arithmetic Evaluation.
The shell performs arithmetic evaluation for The shell performs arithmetic evaluation for
arithmetic substitution, to evaluate an arithmetic command, arithmetic expansion, to evaluate an arithmetic command,
to evaluate an indexed array subscript, to evaluate an indexed array subscript,
and to evaluate arguments to and to evaluate arguments to
the built-in commands the built-in commands
.B shift\^ .B shift\^
and and
.BR let . .B let\^
as well as arguments to numeric format specifiers given to
.B "print -f"\^
and
.BR printf .
Evaluations are performed using Evaluations are performed using
double precision floating point double precision floating point
arithmetic or long double precision floating point for arithmetic or long double precision floating point for
@ -3059,7 +3065,7 @@ the shell prompts with the value of
.SM .SM
.B PS1 .B PS1
after expanding it for parameter expansion, command substitution, and after expanding it for parameter expansion, command substitution, and
arithmetic substitution, arithmetic expansion,
before reading a command. before reading a command.
In addition, each single In addition, each single
.B ! .B !
@ -3081,7 +3087,7 @@ is used with the
.B [[ .B [[
compound command to test attributes of files and to compare compound command to test attributes of files and to compare
strings. strings.
Field splitting and file name generation are Field splitting and pathname expansion are
not performed on the words between not performed on the words between
.B [[ .B [[
and and
@ -3401,12 +3407,12 @@ and are
.I not\^ .I not\^
passed on to the invoked command. passed on to the invoked command.
Command substitution, parameter expansion, Command substitution, parameter expansion,
and arithmetic substitution occur before and arithmetic expansion occur before
.I word\^ .I word\^
or or
.I digit\^ .I digit\^
is used except as noted below. is used except as noted below.
File name generation Pathname expansion
occurs only if the shell is interactive and occurs only if the shell is interactive and
the pattern matches a single file. the pattern matches a single file.
Field splitting is not performed. Field splitting is not performed.
@ -3497,8 +3503,8 @@ The shell input is read up to a line that is the same as
.IR word .IR word
after any quoting has been removed, after any quoting has been removed,
or to an end-of-file. or to an end-of-file.
No parameter substitution, command substitution, arithmetic substitution or No parameter expansion, command substitution, arithmetic expansion or
file name generation is performed on pathname expansion is performed on
.IR word . .IR word .
The resulting document, The resulting document,
called a called a
@ -3510,7 +3516,7 @@ If any character of
is quoted, then no interpretation is quoted, then no interpretation
is placed upon the characters of the document; is placed upon the characters of the document;
otherwise, parameter expansion, command substitution, and arithmetic otherwise, parameter expansion, command substitution, and arithmetic
substitution occur, expansion occur,
.B \enew-line .B \enew-line
is ignored, is ignored,
and and
@ -3541,7 +3547,7 @@ purposes of determining the indentation.
A short form of here document in which \f2word\fP becomes the A short form of here document in which \f2word\fP becomes the
contents of the here-document after any contents of the here-document after any
parameter expansion, command substitution, and arithmetic parameter expansion, command substitution, and arithmetic
substitution occur. expansion occur.
.TP .TP
.BI <& digit .BI <& digit
The standard input is duplicated from file descriptor The standard input is duplicated from file descriptor
@ -4211,7 +4217,7 @@ the
.B trap .B trap
built-in command below). built-in command below).
.SS Execution. .SS Execution.
Each time a command is read, the above substitutions Each time a command is read, the above expansions and substitutions
are carried out. are carried out.
If the command name matches one If the command name matches one
of the of the
@ -4984,7 +4990,7 @@ Same as
.PP .PP
.TP 10 .TP 10
.B M-* .B M-*
Attempt file name generation on the current word. Attempt pathname expansion on the current word.
An asterisk is appended if the word doesn't match any file An asterisk is appended if the word doesn't match any file
or contain any special or contain any special
pattern characters. pattern characters.
@ -5443,7 +5449,7 @@ is omitted.
.B * .B *
Causes an Causes an
.B * .B *
to be appended to the current word and file name generation attempted. to be appended to the current word and pathname expansion attempted.
If no match is found, If no match is found,
it rings the bell. it rings the bell.
Otherwise, the word is replaced Otherwise, the word is replaced
@ -5604,7 +5610,7 @@ This means that tilde expansion is performed after the
.B = .B =
sign, array assignments of the form sign, array assignments of the form
\f2varname\^\fP\f3=(\fP\f2assign_list\^\fP\f3)\fP \f2varname\^\fP\f3=(\fP\f2assign_list\^\fP\f3)\fP
are supported, and field splitting and file name generation are not are supported, and field splitting and pathname expansion are not
performed. performed.
.PD .PD
.TP .TP
@ -7006,11 +7012,11 @@ Requires
to truncate a file when turned on. to truncate a file when turned on.
.TP 8 .TP 8
.B \-G .B \-G
Enables recursive file name generation. Enables recursive pathname expansion.
This adds the double-star pattern This adds the double-star pattern
.B ** .B **
to the file generation mechanism (see to the pathname expansion (see
.I "File Name Generation\^" .I "Pathname Expansion\^"
above). above).
By itself, it matches the recursive contents of the current directory, By itself, it matches the recursive contents of the current directory,
which is to say, all files and directories in the current directory which is to say, all files and directories in the current directory
@ -7035,7 +7041,7 @@ itself and the recursive contents of
Symbolic links to non-directories are not followed. Symbolic links to non-directories are not followed.
Symbolic links to directories are followed if they are specified literally Symbolic links to directories are followed if they are specified literally
or match a pattern as described under or match a pattern as described under
.IR "File Name Generation\^" , .IR "Pathname Expansion\^" ,
but not if they result from a double-star pattern. but not if they result from a double-star pattern.
.TP 8 .TP 8
.B \-H .B \-H
@ -7071,7 +7077,7 @@ and exit.
This mode is disabled while reading profiles. This mode is disabled while reading profiles.
.TP 8 .TP 8
.B \-f .B \-f
Disables file name generation. Disables pathname expansion.
.TP 8 .TP 8
.B \-h .B \-h
Each command Each command
@ -7134,7 +7140,7 @@ Same as
.TP 8 .TP 8
.B globcasedetect .B globcasedetect
When this option is turned on, globbing (see When this option is turned on, globbing (see
.I "File Name Generation\^" .I "Pathname Expansion\^"
above) and above) and
file name listing and completion (see file name listing and completion (see
.I "In-line Editing Options\^" .I "In-line Editing Options\^"
@ -7179,7 +7185,7 @@ command allows octal numbers starting with
On by default if ksh is invoked as \fBsh\fR or \fBrsh\fR. On by default if ksh is invoked as \fBsh\fR or \fBrsh\fR.
.TP 8 .TP 8
.B markdirs .B markdirs
All directory names resulting from file name generation have a trailing All directory names resulting from pathname expansion have a trailing
.B / .B /
appended. appended.
.TP 8 .TP 8
@ -7470,7 +7476,7 @@ not available. Instead, the \f3-a\fP and \f3-o\fP binary operators can be
used, but they are fraught with pitfalls due to grammatical ambiguities and used, but they are fraught with pitfalls due to grammatical ambiguities and
therefore deprecated in favor of invoking separate \f3test\fP commands. Most therefore deprecated in favor of invoking separate \f3test\fP commands. Most
importantly, as \f3test\fP and \f3[\fP are simple regular commands, field importantly, as \f3test\fP and \f3[\fP are simple regular commands, field
splitting and file name generation \f2are\fP performed on all their splitting and pathname expansion \f2are\fP performed on all their
arguments and all aspects of regular shell grammar (such as redirection) arguments and all aspects of regular shell grammar (such as redirection)
remain active. This is usually harmful, so care must be taken to quote remain active. This is usually harmful, so care must be taken to quote
arguments and expansions to avoid this. To avoid the many pitfalls arguments and expansions to avoid this. To avoid the many pitfalls
@ -8333,7 +8339,7 @@ the file named by
.B ENV .B ENV
if the file exists, its name being determined by if the file exists, its name being determined by
performing parameter expansion, command substitution, performing parameter expansion, command substitution,
and arithmetic substitution on and arithmetic expansion on
the value of that environment variable. the value of that environment variable.
If the If the
.B \-s .B \-s