Aspell, fix an Xref, drop trailing whitespace.
This commit is contained in:
parent
8e16397dbf
commit
980a2652ee
88
bin/sh/sh.1
88
bin/sh/sh.1
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: sh.1,v 1.81 2005/07/15 17:23:48 christos Exp $
|
.\" $NetBSD: sh.1,v 1.82 2005/07/15 22:33:48 wiz Exp $
|
||||||
.\" Copyright (c) 1991, 1993
|
.\" Copyright (c) 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
.\"
|
.\"
|
||||||
|
@ -115,7 +115,7 @@ That is, commands
|
||||||
can be typed directly to the running shell or can be put into a file and
|
can be typed directly to the running shell or can be put into a file and
|
||||||
the file can be executed directly by the shell.
|
the file can be executed directly by the shell.
|
||||||
.Ss Invocation
|
.Ss Invocation
|
||||||
If no args are present and if the standard input of the shell
|
If no arguments are present and if the standard input of the shell
|
||||||
is connected to a terminal (or if the
|
is connected to a terminal (or if the
|
||||||
.Fl i
|
.Fl i
|
||||||
flag is set),
|
flag is set),
|
||||||
|
@ -210,7 +210,7 @@ disables the option.
|
||||||
The following options can be set from the command line or
|
The following options can be set from the command line or
|
||||||
with the
|
with the
|
||||||
.Ic set
|
.Ic set
|
||||||
builtin (described later).
|
built-in (described later).
|
||||||
.Bl -tag -width aaaallexportfoo -offset indent
|
.Bl -tag -width aaaallexportfoo -offset indent
|
||||||
.It Fl a Em allexport
|
.It Fl a Em allexport
|
||||||
Export all variables assigned to.
|
Export all variables assigned to.
|
||||||
|
@ -268,7 +268,7 @@ and the file specified by the
|
||||||
.Ev ENV
|
.Ev ENV
|
||||||
environment variable.
|
environment variable.
|
||||||
.It Fl I Em ignoreeof
|
.It Fl I Em ignoreeof
|
||||||
Ignore EOF's from input when interactive.
|
Ignore EOFs from input when interactive.
|
||||||
.It Fl i Em interactive
|
.It Fl i Em interactive
|
||||||
Force the shell to behave interactively.
|
Force the shell to behave interactively.
|
||||||
.It Fl m Em monitor
|
.It Fl m Em monitor
|
||||||
|
@ -368,7 +368,7 @@ Their meaning is discussed later.
|
||||||
.Ss Aliases
|
.Ss Aliases
|
||||||
An alias is a name and corresponding value set using the
|
An alias is a name and corresponding value set using the
|
||||||
.Ic alias
|
.Ic alias
|
||||||
builtin command.
|
built-in command.
|
||||||
Whenever a reserved word may occur (see above),
|
Whenever a reserved word may occur (see above),
|
||||||
and after checking for reserved words, the shell
|
and after checking for reserved words, the shell
|
||||||
checks the word to see if it matches an alias.
|
checks the word to see if it matches an alias.
|
||||||
|
@ -489,7 +489,7 @@ instead of
|
||||||
.Dq \*[Lt]\*[Lt] ,
|
.Dq \*[Lt]\*[Lt] ,
|
||||||
then leading tabs in the here-doc-text are stripped.
|
then leading tabs in the here-doc-text are stripped.
|
||||||
.Ss Search and Execution
|
.Ss Search and Execution
|
||||||
There are three types of commands: shell functions, builtin commands, and
|
There are three types of commands: shell functions, built-in commands, and
|
||||||
normal programs -- and the command is searched for (by name) in that order.
|
normal programs -- and the command is searched for (by name) in that order.
|
||||||
They each are executed in a different way.
|
They each are executed in a different way.
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -504,10 +504,10 @@ The positional parameters are restored to their original values
|
||||||
when the command completes.
|
when the command completes.
|
||||||
This all occurs within the current shell.
|
This all occurs within the current shell.
|
||||||
.Pp
|
.Pp
|
||||||
Shell builtins are executed internally to the shell, without spawning a
|
Shell built-ins are executed internally to the shell, without spawning a
|
||||||
new process.
|
new process.
|
||||||
.Pp
|
.Pp
|
||||||
Otherwise, if the command name doesn't match a function or builtin, the
|
Otherwise, if the command name doesn't match a function or built-in, the
|
||||||
command is searched for as a normal program in the file system (as
|
command is searched for as a normal program in the file system (as
|
||||||
described in the next section).
|
described in the next section).
|
||||||
When a normal program is executed, the shell runs the program,
|
When a normal program is executed, the shell runs the program,
|
||||||
|
@ -532,8 +532,8 @@ number as a "shell procedure".
|
||||||
.Ss Path Search
|
.Ss Path Search
|
||||||
When locating a command, the shell first looks to see if it has a shell
|
When locating a command, the shell first looks to see if it has a shell
|
||||||
function by that name.
|
function by that name.
|
||||||
Then it looks for a builtin command by that name.
|
Then it looks for a built-in command by that name.
|
||||||
If a builtin command is not found, one of two things happen:
|
If a built-in command is not found, one of two things happen:
|
||||||
.Bl -enum
|
.Bl -enum
|
||||||
.It
|
.It
|
||||||
Command names containing a slash are simply executed without performing
|
Command names containing a slash are simply executed without performing
|
||||||
|
@ -557,7 +557,7 @@ with zero for normal or success, and non-zero for failure,
|
||||||
error, or a false indication.
|
error, or a false indication.
|
||||||
The man page for each command
|
The man page for each command
|
||||||
should indicate the various exit codes and what they mean.
|
should indicate the various exit codes and what they mean.
|
||||||
Additionally, the builtin commands return exit codes, as does
|
Additionally, the built-in commands return exit codes, as does
|
||||||
an executed shell function.
|
an executed shell function.
|
||||||
.Pp
|
.Pp
|
||||||
If a command consists entirely of variable assignments then the
|
If a command consists entirely of variable assignments then the
|
||||||
|
@ -628,7 +628,7 @@ next) to be executed sequentially; a \*[Am] causes asynchronous execution of
|
||||||
the preceding AND-OR-list.
|
the preceding AND-OR-list.
|
||||||
.Pp
|
.Pp
|
||||||
Note that unlike some other shells, each process in the pipeline is a
|
Note that unlike some other shells, each process in the pipeline is a
|
||||||
child of the invoking shell (unless it is a shell builtin, in which case
|
child of the invoking shell (unless it is a shell built-in, in which case
|
||||||
it executes in the current shell -- but any effect it has on the
|
it executes in the current shell -- but any effect it has on the
|
||||||
environment is wiped).
|
environment is wiped).
|
||||||
.Ss Background Commands -- \*[Am]
|
.Ss Background Commands -- \*[Am]
|
||||||
|
@ -667,7 +667,7 @@ and
|
||||||
.Dq ||
|
.Dq ||
|
||||||
both have the same priority.
|
both have the same priority.
|
||||||
Note that these operators are left-associative, so
|
Note that these operators are left-associative, so
|
||||||
.Dq true || echo bar && echo baz
|
.Dq true || echo bar \*[Am]\*[Am] echo baz
|
||||||
writes
|
writes
|
||||||
.Dq baz
|
.Dq baz
|
||||||
and nothing else.
|
and nothing else.
|
||||||
|
@ -718,7 +718,7 @@ continue [ num ]
|
||||||
.Pp
|
.Pp
|
||||||
Break terminates the num innermost for or while loops.
|
Break terminates the num innermost for or while loops.
|
||||||
Continue continues with the next iteration of the innermost loop.
|
Continue continues with the next iteration of the innermost loop.
|
||||||
These are implemented as builtin commands.
|
These are implemented as built-in commands.
|
||||||
.Pp
|
.Pp
|
||||||
The syntax of the case command is
|
The syntax of the case command is
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
|
@ -743,7 +743,7 @@ or
|
||||||
.Dl { list; }
|
.Dl { list; }
|
||||||
.Pp
|
.Pp
|
||||||
The first of these executes the commands in a subshell.
|
The first of these executes the commands in a subshell.
|
||||||
Builtin commands grouped into a (list) will not affect the current shell.
|
Built-in commands grouped into a (list) will not affect the current shell.
|
||||||
The second form does not fork another shell so is slightly more efficient.
|
The second form does not fork another shell so is slightly more efficient.
|
||||||
Grouping commands together this way allows you to redirect
|
Grouping commands together this way allows you to redirect
|
||||||
their output as though they were one program:
|
their output as though they were one program:
|
||||||
|
@ -775,10 +775,10 @@ This should appear as the first statement of a function, and the syntax is
|
||||||
.Pp
|
.Pp
|
||||||
.Dl local [ variable | - ] ...
|
.Dl local [ variable | - ] ...
|
||||||
.Pp
|
.Pp
|
||||||
Local is implemented as a builtin command.
|
Local is implemented as a built-in command.
|
||||||
.Pp
|
.Pp
|
||||||
When a variable is made local, it inherits the initial value and exported
|
When a variable is made local, it inherits the initial value and exported
|
||||||
and readonly flags from the variable with the same name in the surrounding
|
and read-only flags from the variable with the same name in the surrounding
|
||||||
scope, if there is one.
|
scope, if there is one.
|
||||||
Otherwise, the variable is initially unset.
|
Otherwise, the variable is initially unset.
|
||||||
The shell uses dynamic scoping, so that if you make the variable x local to
|
The shell uses dynamic scoping, so that if you make the variable x local to
|
||||||
|
@ -799,7 +799,7 @@ The syntax of the return command is
|
||||||
.Dl return [ exitstatus ]
|
.Dl return [ exitstatus ]
|
||||||
.Pp
|
.Pp
|
||||||
It terminates the currently executing function.
|
It terminates the currently executing function.
|
||||||
Return is implemented as a builtin command.
|
Return is implemented as a built-in command.
|
||||||
.Ss Variables and Parameters
|
.Ss Variables and Parameters
|
||||||
The shell maintains a set of parameters.
|
The shell maintains a set of parameters.
|
||||||
A parameter denoted by a name is called a variable.
|
A parameter denoted by a name is called a variable.
|
||||||
|
@ -820,7 +820,7 @@ The shell sets these initially to the values of its command line arguments
|
||||||
that follow the name of the shell script.
|
that follow the name of the shell script.
|
||||||
The
|
The
|
||||||
.Ic set
|
.Ic set
|
||||||
builtin can also be used to set or reset them.
|
built-in can also be used to set or reset them.
|
||||||
.Ss Special Parameters
|
.Ss Special Parameters
|
||||||
A special parameter is a parameter denoted by one of the following special
|
A special parameter is a parameter denoted by one of the following special
|
||||||
characters.
|
characters.
|
||||||
|
@ -865,7 +865,7 @@ Expands to the exit status of the most recent pipeline.
|
||||||
.It - (Hyphen.)
|
.It - (Hyphen.)
|
||||||
Expands to the current option flags (the single-letter
|
Expands to the current option flags (the single-letter
|
||||||
option names concatenated into a string) as specified on
|
option names concatenated into a string) as specified on
|
||||||
invocation, by the set builtin command, or implicitly
|
invocation, by the set built-in command, or implicitly
|
||||||
by the shell.
|
by the shell.
|
||||||
.It $
|
.It $
|
||||||
Expands to the process ID of the invoked shell.
|
Expands to the process ID of the invoked shell.
|
||||||
|
@ -1145,12 +1145,12 @@ in a character class, make it the first character listed (after the
|
||||||
.Dq \&! ,
|
.Dq \&! ,
|
||||||
if any).
|
if any).
|
||||||
To include a minus sign, make it the first or last character listed.
|
To include a minus sign, make it the first or last character listed.
|
||||||
.Ss Builtins
|
.Ss Built-ins
|
||||||
This section lists the builtin commands which are builtin because they
|
This section lists the built-in commands which are built-in because they
|
||||||
need to perform some operation that can't be performed by a separate
|
need to perform some operation that can't be performed by a separate
|
||||||
process.
|
process.
|
||||||
In addition to these, there are several other commands that may
|
In addition to these, there are several other commands that may
|
||||||
be builtin for efficiency (e.g.
|
be built-in for efficiency (e.g.
|
||||||
.Xr printf 1 ,
|
.Xr printf 1 ,
|
||||||
.Xr echo 1 ,
|
.Xr echo 1 ,
|
||||||
.Xr test 1 ,
|
.Xr test 1 ,
|
||||||
|
@ -1174,7 +1174,7 @@ is specified, the value of the alias
|
||||||
is printed.
|
is printed.
|
||||||
With no arguments, the
|
With no arguments, the
|
||||||
.Ic alias
|
.Ic alias
|
||||||
builtin prints the
|
built-in prints the
|
||||||
names and values of all defined aliases (see
|
names and values of all defined aliases (see
|
||||||
.Ic unalias ) .
|
.Ic unalias ) .
|
||||||
.It bg [ Ar job ] ...
|
.It bg [ Ar job ] ...
|
||||||
|
@ -1190,7 +1190,7 @@ jobs are given) in the background.
|
||||||
Execute the specified command but ignore shell functions when searching
|
Execute the specified command but ignore shell functions when searching
|
||||||
for it.
|
for it.
|
||||||
(This is useful when you
|
(This is useful when you
|
||||||
have a shell function with the same name as a builtin command.)
|
have a shell function with the same name as a built-in command.)
|
||||||
.Bl -tag -width 5n
|
.Bl -tag -width 5n
|
||||||
.It Fl p
|
.It Fl p
|
||||||
search for command using a
|
search for command using a
|
||||||
|
@ -1200,11 +1200,11 @@ that guarantees to find all the standard utilities.
|
||||||
Do not execute the command but
|
Do not execute the command but
|
||||||
search for the command and print the resolution of the
|
search for the command and print the resolution of the
|
||||||
command search.
|
command search.
|
||||||
This is the same as the type builtin.
|
This is the same as the type built-in.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
Do not execute the command but
|
Do not execute the command but
|
||||||
search for the command and print the absolute pathname
|
search for the command and print the absolute pathname
|
||||||
of utilities, the name for builtins or the expansion of aliases.
|
of utilities, the name for built-ins or the expansion of aliases.
|
||||||
.El
|
.El
|
||||||
.It cd Op Ar directory Op Ar replace
|
.It cd Op Ar directory Op Ar replace
|
||||||
Switch to the specified directory (default
|
Switch to the specified directory (default
|
||||||
|
@ -1243,7 +1243,7 @@ Concatenate all the arguments with spaces.
|
||||||
Then re-parse and execute the command.
|
Then re-parse and execute the command.
|
||||||
.It exec Op Ar command arg ...
|
.It exec Op Ar command arg ...
|
||||||
Unless command is omitted, the shell process is replaced with the
|
Unless command is omitted, the shell process is replaced with the
|
||||||
specified program (which must be a real program, not a shell builtin or
|
specified program (which must be a real program, not a shell built-in or
|
||||||
function).
|
function).
|
||||||
Any redirections on the
|
Any redirections on the
|
||||||
.Ic exec
|
.Ic exec
|
||||||
|
@ -1282,7 +1282,7 @@ option specified the output will be formatted suitably for non-interactive use.
|
||||||
.Xc
|
.Xc
|
||||||
The
|
The
|
||||||
.Ic fc
|
.Ic fc
|
||||||
builtin lists, or edits and re-executes, commands previously entered
|
built-in lists, or edits and re-executes, commands previously entered
|
||||||
to an interactive shell.
|
to an interactive shell.
|
||||||
.Bl -tag -width 5n
|
.Bl -tag -width 5n
|
||||||
.It Fl e No editor
|
.It Fl e No editor
|
||||||
|
@ -1380,7 +1380,7 @@ utility due to its handling of arguments containing whitespace.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Ic getopts
|
.Ic getopts
|
||||||
builtin may be used to obtain options and their arguments
|
built-in may be used to obtain options and their arguments
|
||||||
from a list of parameters.
|
from a list of parameters.
|
||||||
When invoked,
|
When invoked,
|
||||||
.Ic getopts
|
.Ic getopts
|
||||||
|
@ -1394,7 +1394,7 @@ When the shell is invoked,
|
||||||
is initialized to 1.
|
is initialized to 1.
|
||||||
For each option that requires an argument, the
|
For each option that requires an argument, the
|
||||||
.Ic getopts
|
.Ic getopts
|
||||||
builtin will place it in the shell variable
|
built-in will place it in the shell variable
|
||||||
.Ev OPTARG .
|
.Ev OPTARG .
|
||||||
If an option is not allowed for in the
|
If an option is not allowed for in the
|
||||||
.Va optstring ,
|
.Va optstring ,
|
||||||
|
@ -1507,7 +1507,7 @@ is specified the cached value (initially set from
|
||||||
is checked to see if it refers to the current directory, if it does
|
is checked to see if it refers to the current directory, if it does
|
||||||
the value is printed.
|
the value is printed.
|
||||||
Otherwise the current directory name is found using
|
Otherwise the current directory name is found using
|
||||||
.Xr getcwd(3) .
|
.Xr getcwd 3 .
|
||||||
The environment variable
|
The environment variable
|
||||||
.Ev PWD
|
.Ev PWD
|
||||||
is set to printed value.
|
is set to printed value.
|
||||||
|
@ -1515,7 +1515,7 @@ is set to printed value.
|
||||||
The default is
|
The default is
|
||||||
.Ic pwd
|
.Ic pwd
|
||||||
.Fl L ,
|
.Fl L ,
|
||||||
but note that the builtin
|
but note that the built-in
|
||||||
.Ic cd
|
.Ic cd
|
||||||
command doesn't currently support
|
command doesn't currently support
|
||||||
.Fl L
|
.Fl L
|
||||||
|
@ -1536,10 +1536,10 @@ same directory, or the initial
|
||||||
value followed a symbolic link, then the cached value may not
|
value followed a symbolic link, then the cached value may not
|
||||||
be the absolute path.
|
be the absolute path.
|
||||||
.Pp
|
.Pp
|
||||||
The builtin command may differ from the program of the same name because
|
The built-in command may differ from the program of the same name because
|
||||||
the program will use
|
the program will use
|
||||||
.Ev PWD
|
.Ev PWD
|
||||||
and the builtin uses a separately cached value.
|
and the built-in uses a separately cached value.
|
||||||
.It Xo read Op Fl p Ar prompt
|
.It Xo read Op Fl p Ar prompt
|
||||||
.Op Fl r
|
.Op Fl r
|
||||||
.Ar variable
|
.Ar variable
|
||||||
|
@ -1560,7 +1560,7 @@ If there are more variables than pieces,
|
||||||
the remaining variables are assigned the null string.
|
the remaining variables are assigned the null string.
|
||||||
The
|
The
|
||||||
.Ic read
|
.Ic read
|
||||||
builtin will indicate success unless EOF is encountered on input, in
|
built-in will indicate success unless EOF is encountered on input, in
|
||||||
which case failure is returned.
|
which case failure is returned.
|
||||||
.Pp
|
.Pp
|
||||||
By default, unless the
|
By default, unless the
|
||||||
|
@ -1602,12 +1602,12 @@ flags, or clears them as described in the section called
|
||||||
.Sx Argument List Processing .
|
.Sx Argument List Processing .
|
||||||
.Pp
|
.Pp
|
||||||
The third use of the set command is to set the values of the shell's
|
The third use of the set command is to set the values of the shell's
|
||||||
positional parameters to the specified args.
|
positional parameters to the specified arguments.
|
||||||
To change the positional
|
To change the positional
|
||||||
parameters without changing any options, use
|
parameters without changing any options, use
|
||||||
.Dq --
|
.Dq --
|
||||||
as the first argument to set.
|
as the first argument to set.
|
||||||
If no args are present, the set command
|
If no arguments are present, the set command
|
||||||
will clear all the positional parameters (equivalent to executing
|
will clear all the positional parameters (equivalent to executing
|
||||||
.Dq shift $# . )
|
.Dq shift $# . )
|
||||||
.It setvar Ar variable Ar value
|
.It setvar Ar variable Ar value
|
||||||
|
@ -1664,7 +1664,7 @@ On non-interactive shells, the
|
||||||
.Ic trap
|
.Ic trap
|
||||||
command has no effect on signals that were
|
command has no effect on signals that were
|
||||||
ignored on entry to the shell.
|
ignored on entry to the shell.
|
||||||
On interractive shells, the
|
On interactive shells, the
|
||||||
.Ic trap
|
.Ic trap
|
||||||
command will catch or reset signals ignored on entry.
|
command will catch or reset signals ignored on entry.
|
||||||
Issuing
|
Issuing
|
||||||
|
@ -1698,7 +1698,7 @@ Print date upon receiving signal INT
|
||||||
Interpret each name as a command and print the resolution of the command
|
Interpret each name as a command and print the resolution of the command
|
||||||
search.
|
search.
|
||||||
Possible resolutions are:
|
Possible resolutions are:
|
||||||
shell keyword, alias, shell builtin,
|
shell keyword, alias, shell built-in,
|
||||||
command, tracked alias and not found.
|
command, tracked alias and not found.
|
||||||
For aliases the alias expansion is
|
For aliases the alias expansion is
|
||||||
printed; for commands and tracked aliases the complete pathname of the
|
printed; for commands and tracked aliases the complete pathname of the
|
||||||
|
@ -1800,7 +1800,7 @@ is being used interactively from a terminal, the current command
|
||||||
and the command history (see
|
and the command history (see
|
||||||
.Ic fc
|
.Ic fc
|
||||||
in
|
in
|
||||||
.Sx Builtins )
|
.Sx Built-ins )
|
||||||
can be edited using emacs-mode or vi-mode command-line editing.
|
can be edited using emacs-mode or vi-mode command-line editing.
|
||||||
The command
|
The command
|
||||||
.Ql set -o emacs
|
.Ql set -o emacs
|
||||||
|
@ -1840,7 +1840,7 @@ If the shell is not an
|
||||||
interactive shell, the execution of the shell file will be aborted.
|
interactive shell, the execution of the shell file will be aborted.
|
||||||
Otherwise
|
Otherwise
|
||||||
the shell will return the exit status of the last command executed, or
|
the shell will return the exit status of the last command executed, or
|
||||||
if the exit builtin is used with a numeric argument, it will return the
|
if the exit built-in is used with a numeric argument, it will return the
|
||||||
argument.
|
argument.
|
||||||
.Sh ENVIRONMENT
|
.Sh ENVIRONMENT
|
||||||
.Bl -tag -width MAILCHECK
|
.Bl -tag -width MAILCHECK
|
||||||
|
@ -1850,13 +1850,13 @@ Set automatically by
|
||||||
from the user's login directory in the password file
|
from the user's login directory in the password file
|
||||||
.Pq Xr passwd 5 .
|
.Pq Xr passwd 5 .
|
||||||
This environment variable also functions as the default argument for the
|
This environment variable also functions as the default argument for the
|
||||||
cd builtin.
|
cd built-in.
|
||||||
.It Ev PATH
|
.It Ev PATH
|
||||||
The default search path for executables.
|
The default search path for executables.
|
||||||
See the above section
|
See the above section
|
||||||
.Sx Path Search .
|
.Sx Path Search .
|
||||||
.It Ev CDPATH
|
.It Ev CDPATH
|
||||||
The search path used with the cd builtin.
|
The search path used with the cd built-in.
|
||||||
.It Ev LANG
|
.It Ev LANG
|
||||||
The string used to specify localization information that allows users
|
The string used to specify localization information that allows users
|
||||||
to work with different culture-specific and language conventions.
|
to work with different culture-specific and language conventions.
|
||||||
|
|
Loading…
Reference in New Issue