- document IFS behavior changes
- grammar, punctuation, xref, mdoc tweaks - sort keywords - indent example displays - minimize against diffing between sh.1tbl - document set -o sh - tweak the displays of some editing and builtin commands - rework some operator descriptions From: Jared J. Yanovich <jaredy@cvs.openbsd.org> These man pages are not derived from UCB and are actually public domain. Verified with aaron@ who did the conversion from man -> mdoc. From: Todd C. Miller <millert@cvs.openbsd.org> - cleanup - ", and" and ", or" lose the comma where superfluous
This commit is contained in:
parent
1a183984c4
commit
3cba14dc9d
432
ksh.1tbl
432
ksh.1tbl
@ -1,37 +1,8 @@
|
|||||||
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.7 2004/12/18 19:02:29 tg Exp $
|
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.8 2004/12/31 18:22:54 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1tbl,v 1.79 2004/12/04 07:05:13 jaredy Exp $
|
.\" $OpenBSD: ksh.1tbl,v 1.84 2004/12/22 18:58:44 millert Exp $
|
||||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1980, 1990, 1993
|
.\" Public Domain.
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
|
||||||
.\" Copyright (c) 2003, 2004
|
|
||||||
.\" The MirOS Project (http://mirbsd.de/). All rights reserved.
|
|
||||||
.\"
|
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
|
||||||
.\" modification, are permitted provided that the following conditions
|
|
||||||
.\" are met:
|
|
||||||
.\" 1. Redistributions of source code must retain the above copyright
|
|
||||||
.\" notice, this list of conditions and the following disclaimer.
|
|
||||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
.\" notice, this list of conditions and the following disclaimer in the
|
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
|
||||||
.\" 3. Neither the name of the University nor the names of its contributors
|
|
||||||
.\" may be used to endorse or promote products derived from this software
|
|
||||||
.\" without specific prior written permission.
|
|
||||||
.\"
|
|
||||||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
.\" SUCH DAMAGE.
|
|
||||||
.\"
|
|
||||||
.\" @(#)ksh.1tbl 8.2 (Berkeley) 8/19/96
|
|
||||||
.\"
|
.\"
|
||||||
.Dd November 10, 2004
|
.Dd November 10, 2004
|
||||||
.Dt KSH 1
|
.Dt KSH 1
|
||||||
@ -140,7 +111,7 @@ An interactive shell has job control enabled (if available), ignores the
|
|||||||
.Dv SIGQUIT
|
.Dv SIGQUIT
|
||||||
and
|
and
|
||||||
.Dv SIGTERM
|
.Dv SIGTERM
|
||||||
signals, and prints prompts before reading input (see
|
signals and prints prompts before reading input (see
|
||||||
.Ev PS1
|
.Ev PS1
|
||||||
and
|
and
|
||||||
.Ev PS2
|
.Ev PS2
|
||||||
@ -250,7 +221,7 @@ If the
|
|||||||
.Ev ENV
|
.Ev ENV
|
||||||
parameter is set when the shell starts (or, in the case of login shells,
|
parameter is set when the shell starts (or, in the case of login shells,
|
||||||
after any profiles are processed), its value is subjected to parameter,
|
after any profiles are processed), its value is subjected to parameter,
|
||||||
command, arithmetic, and tilde
|
command, arithmetic and tilde
|
||||||
.Pq Sq \&~
|
.Pq Sq \&~
|
||||||
substitution and the resulting file
|
substitution and the resulting file
|
||||||
(if any) is read and executed.
|
(if any) is read and executed.
|
||||||
@ -269,13 +240,13 @@ The exit status of the shell is 127 if the command file specified on the
|
|||||||
command line could not be opened, or non-zero if a fatal syntax error
|
command line could not be opened, or non-zero if a fatal syntax error
|
||||||
occurred during the execution of a script.
|
occurred during the execution of a script.
|
||||||
In the absence of fatal errors,
|
In the absence of fatal errors,
|
||||||
the exit status is that of the last command executed, or zero, if no
|
the exit status is that of the last command executed, or zero if no
|
||||||
command is executed.
|
command is executed.
|
||||||
.Ss Command syntax
|
.Ss Command syntax
|
||||||
The shells begins parsing its input by breaking it into
|
The shell begins parsing its input by breaking it into
|
||||||
.Em words .
|
.Em words .
|
||||||
Words, which are sequences of characters, are delimited by unquoted whitespace
|
Words, which are sequences of characters, are delimited by unquoted whitespace
|
||||||
characters (space, tab, and newline) or meta-characters
|
characters (space, tab and newline) or meta-characters
|
||||||
.Po
|
.Po
|
||||||
.Ql < ,
|
.Ql < ,
|
||||||
.Ql > ,
|
.Ql > ,
|
||||||
@ -352,7 +323,7 @@ the
|
|||||||
.Ql #
|
.Ql #
|
||||||
up to the nearest newline is ignored;
|
up to the nearest newline is ignored;
|
||||||
.Ql $
|
.Ql $
|
||||||
is used to introduce parameter, command, and arithmetic substitutions (see
|
is used to introduce parameter, command and arithmetic substitutions (see
|
||||||
.Sx Substitution
|
.Sx Substitution
|
||||||
below);
|
below);
|
||||||
.Ql `
|
.Ql `
|
||||||
@ -389,7 +360,7 @@ such as
|
|||||||
.Ic for
|
.Ic for
|
||||||
and
|
and
|
||||||
.Ic if
|
.Ic if
|
||||||
statements, grouping constructs, and function definitions.
|
statements, grouping constructs and function definitions.
|
||||||
.Pp
|
.Pp
|
||||||
A simple-command consists of some combination of parameter assignments
|
A simple-command consists of some combination of parameter assignments
|
||||||
(see
|
(see
|
||||||
@ -515,21 +486,12 @@ These words
|
|||||||
are only recognized if they are unquoted and if they are used as the first
|
are only recognized if they are unquoted and if they are used as the first
|
||||||
word of a command (i.e., they can't be preceded by parameter assignments or
|
word of a command (i.e., they can't be preceded by parameter assignments or
|
||||||
redirections):
|
redirections):
|
||||||
.Pp
|
.Bd -literal -offset center
|
||||||
.\" .TS
|
case else function then !
|
||||||
.\" center;
|
do esac if time [[
|
||||||
.\" lfB lfB lfB lfB lfB .
|
done fi in until {
|
||||||
.\" case else function then !
|
elif for select while }
|
||||||
.\" do esac if time [[
|
.Ed
|
||||||
.\" done fi in until {
|
|
||||||
.\" elif for select while }
|
|
||||||
.\" .TE
|
|
||||||
.\"
|
|
||||||
.Ic case , do , done , elif ,
|
|
||||||
.Ic else , esac , fi , for ,
|
|
||||||
.Ic function , if , in , select ,
|
|
||||||
.Ic then , time , until , while ,
|
|
||||||
.Ic \&! , \&[\&[ , \&{ , \&}
|
|
||||||
.Pp
|
.Pp
|
||||||
.Sy Note:
|
.Sy Note:
|
||||||
Some shells (but not this one) execute control structure commands in a
|
Some shells (but not this one) execute control structure commands in a
|
||||||
@ -542,7 +504,7 @@ control structure.
|
|||||||
.Pp
|
.Pp
|
||||||
In the following compound command descriptions, command lists (denoted as
|
In the following compound command descriptions, command lists (denoted as
|
||||||
.Em list )
|
.Em list )
|
||||||
that are followed by reserved words must end with a semicolon, a newline, or
|
that are followed by reserved words must end with a semicolon, a newline or
|
||||||
a (syntactically correct) reserved word.
|
a (syntactically correct) reserved word.
|
||||||
For example,
|
For example,
|
||||||
.Bd -unfilled -offset indent
|
.Bd -unfilled -offset indent
|
||||||
@ -600,7 +562,7 @@ are dropped.
|
|||||||
Note that any unquoted space before and after a pattern is
|
Note that any unquoted space before and after a pattern is
|
||||||
stripped; any space within a pattern must be quoted.
|
stripped; any space within a pattern must be quoted.
|
||||||
Both the word and the
|
Both the word and the
|
||||||
patterns are subject to parameter, command, and arithmetic substitution, as
|
patterns are subject to parameter, command and arithmetic substitution, as
|
||||||
well as tilde substitution.
|
well as tilde substitution.
|
||||||
For historical reasons, open and close braces may be used instead of
|
For historical reasons, open and close braces may be used instead of
|
||||||
.Ic in
|
.Ic in
|
||||||
@ -700,7 +662,7 @@ standard input,
|
|||||||
.Ar name
|
.Ar name
|
||||||
is set to the selected word (or unset if the selection is not valid),
|
is set to the selected word (or unset if the selection is not valid),
|
||||||
.Ev REPLY
|
.Ev REPLY
|
||||||
is set to what was read (leading/trailing space is stripped), and
|
is set to what was read (leading/trailing space is stripped) and
|
||||||
.Ar list
|
.Ar list
|
||||||
is executed.
|
is executed.
|
||||||
If a blank line (i.e., zero or more
|
If a blank line (i.e., zero or more
|
||||||
@ -715,7 +677,7 @@ is
|
|||||||
.Dv NULL ,
|
.Dv NULL ,
|
||||||
the prompt is printed and so on.
|
the prompt is printed and so on.
|
||||||
This process continues until an end-of-file
|
This process continues until an end-of-file
|
||||||
is read, an interrupt is received, or a
|
is read, an interrupt is received or a
|
||||||
.Ic break
|
.Ic break
|
||||||
statement is executed inside the loop.
|
statement is executed inside the loop.
|
||||||
If
|
If
|
||||||
@ -842,7 +804,7 @@ operators must always be used (e.g., instead of
|
|||||||
use
|
use
|
||||||
.Ic \&[[ Fl n Ar str Ic \&]] ) .
|
.Ic \&[[ Fl n Ar str Ic \&]] ) .
|
||||||
.It
|
.It
|
||||||
Parameter, command, and arithmetic substitutions are performed as expressions
|
Parameter, command and arithmetic substitutions are performed as expressions
|
||||||
are evaluated and lazy expression evaluation is used for the
|
are evaluated and lazy expression evaluation is used for the
|
||||||
.Ql &&
|
.Ql &&
|
||||||
and
|
and
|
||||||
@ -850,10 +812,10 @@ and
|
|||||||
operators.
|
operators.
|
||||||
This means that in the statement
|
This means that in the statement
|
||||||
.Pp
|
.Pp
|
||||||
.Ic \&[[ -r foo && $(< foo) = b*r ]]
|
.Dl Ic "[[ -r foo && $(<foo) = b*r ]]"
|
||||||
.Pp
|
.Pp
|
||||||
the
|
the
|
||||||
.Ic $(< foo)
|
.Ic $(<foo)
|
||||||
is evaluated if and only if the file
|
is evaluated if and only if the file
|
||||||
.Pa foo
|
.Pa foo
|
||||||
exists and is readable.
|
exists and is readable.
|
||||||
@ -954,7 +916,7 @@ The first time the shell does a path search for a command that is
|
|||||||
marked as a tracked alias, it saves the full path of the command.
|
marked as a tracked alias, it saves the full path of the command.
|
||||||
The next
|
The next
|
||||||
time the command is executed, the shell checks the saved path to see that it
|
time the command is executed, the shell checks the saved path to see that it
|
||||||
is still valid, and if so, avoids repeating the path search.
|
is still valid and, if so, avoids repeating the path search.
|
||||||
Tracked aliases can be listed and created using
|
Tracked aliases can be listed and created using
|
||||||
.Ic alias -t .
|
.Ic alias -t .
|
||||||
Note that changing the
|
Note that changing the
|
||||||
@ -981,7 +943,7 @@ and
|
|||||||
The first step the shell takes in executing a simple-command is to perform
|
The first step the shell takes in executing a simple-command is to perform
|
||||||
substitutions on the words of the command.
|
substitutions on the words of the command.
|
||||||
There are three kinds of
|
There are three kinds of
|
||||||
substitution: parameter, command, and arithmetic.
|
substitution: parameter, command and arithmetic.
|
||||||
Parameter substitutions,
|
Parameter substitutions,
|
||||||
which are described in detail in the next section, take the form
|
which are described in detail in the next section, take the form
|
||||||
.Ic $ Ns Ar name
|
.Ic $ Ns Ar name
|
||||||
@ -1002,7 +964,7 @@ parameter.
|
|||||||
The
|
The
|
||||||
.Ev IFS
|
.Ev IFS
|
||||||
parameter specifies a list of characters which are used to break a string up
|
parameter specifies a list of characters which are used to break a string up
|
||||||
into several words; any characters from the set space, tab, and newline that
|
into several words; any characters from the set space, tab and newline that
|
||||||
appear in the
|
appear in the
|
||||||
.Ev IFS
|
.Ev IFS
|
||||||
characters are called
|
characters are called
|
||||||
@ -1038,7 +1000,7 @@ Note that if the
|
|||||||
.Ev IFS
|
.Ev IFS
|
||||||
parameter is set to the null
|
parameter is set to the null
|
||||||
string, no field splitting is done; if the parameter is unset, the default
|
string, no field splitting is done; if the parameter is unset, the default
|
||||||
value of space, tab, and newline is used.
|
value of space, tab and newline is used.
|
||||||
.Pp
|
.Pp
|
||||||
The results of substitution are, unless otherwise specified, also subject to
|
The results of substitution are, unless otherwise specified, also subject to
|
||||||
brace expansion and file name expansion (see the relevant sections below).
|
brace expansion and file name expansion (see the relevant sections below).
|
||||||
@ -1089,12 +1051,12 @@ Parameters are shell variables; they can be assigned values and their values
|
|||||||
can be accessed using a parameter substitution.
|
can be accessed using a parameter substitution.
|
||||||
A parameter name is either one
|
A parameter name is either one
|
||||||
of the special single punctuation or digit character parameters described
|
of the special single punctuation or digit character parameters described
|
||||||
below, or a letter followed by zero or more letters or digits
|
below or a letter followed by zero or more letters or digits
|
||||||
.Po
|
.Po
|
||||||
.Ql _
|
.Ql _
|
||||||
counts as a letter
|
counts as a letter
|
||||||
.Pc .
|
.Pc .
|
||||||
The later form can be treated as arrays by appending an array index of the
|
The latter form can be treated as arrays by appending an array index of the
|
||||||
form
|
form
|
||||||
.Op Ar expr
|
.Op Ar expr
|
||||||
where
|
where
|
||||||
@ -1177,7 +1139,7 @@ Parameters with the export attribute (set using the
|
|||||||
.Ic export
|
.Ic export
|
||||||
or
|
or
|
||||||
.Ic typeset Fl x
|
.Ic typeset Fl x
|
||||||
commands, or by parameter assignments followed by simple commands) are put in
|
commands or by parameter assignments followed by simple commands) are put in
|
||||||
the environment (see
|
the environment (see
|
||||||
.Xr environ 7 )
|
.Xr environ 7 )
|
||||||
of commands run by the shell as
|
of commands run by the shell as
|
||||||
@ -1250,7 +1212,7 @@ being set (as opposed to set and not
|
|||||||
.Dv NULL ) .
|
.Dv NULL ) .
|
||||||
If
|
If
|
||||||
.Ar word
|
.Ar word
|
||||||
is needed, parameter, command, arithmetic, and tilde substitution are performed
|
is needed, parameter, command, arithmetic and tilde substitution are performed
|
||||||
on it; if
|
on it; if
|
||||||
.Ar word
|
.Ar word
|
||||||
is not needed, it is not evaluated.
|
is not needed, it is not evaluated.
|
||||||
@ -1286,8 +1248,7 @@ matches the beginning of the value of parameter
|
|||||||
the matched text is deleted from the result of substitution.
|
the matched text is deleted from the result of substitution.
|
||||||
A single
|
A single
|
||||||
.Ql #
|
.Ql #
|
||||||
results in the shortest match, and two
|
results in the shortest match, two of them result in the longest match.
|
||||||
of them result in the longest match.
|
|
||||||
.Sm off
|
.Sm off
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic ${ Ar name Ic % Ar pattern
|
.Ic ${ Ar name Ic % Ar pattern
|
||||||
@ -1411,7 +1372,7 @@ Currently set to the
|
|||||||
value as reported by
|
value as reported by
|
||||||
.Xr stty 1
|
.Xr stty 1
|
||||||
if that value is non-zero.
|
if that value is non-zero.
|
||||||
This parameter is used by the interactive line editing modes, and by the
|
This parameter is used by the interactive line editing modes and by the
|
||||||
.Ic select ,
|
.Ic select ,
|
||||||
.Ic set Fl o
|
.Ic set Fl o
|
||||||
and
|
and
|
||||||
@ -1511,7 +1472,7 @@ Not yet implemented.
|
|||||||
The previous working directory.
|
The previous working directory.
|
||||||
Unset if
|
Unset if
|
||||||
.Ic cd
|
.Ic cd
|
||||||
has not successfully changed directories since the shell started, or if the
|
has not successfully changed directories since the shell started or the
|
||||||
shell doesn't know where it is.
|
shell doesn't know where it is.
|
||||||
.It Ev OPTARG
|
.It Ev OPTARG
|
||||||
When using
|
When using
|
||||||
@ -1530,6 +1491,7 @@ An empty string resulting from a leading or trailing
|
|||||||
colon, or two adjacent colons, is treated as a
|
colon, or two adjacent colons, is treated as a
|
||||||
.Dq \&. ,
|
.Dq \&. ,
|
||||||
the current directory.
|
the current directory.
|
||||||
|
This is dangerous.
|
||||||
.It Ev POSIXLY_CORRECT
|
.It Ev POSIXLY_CORRECT
|
||||||
If set, this parameter causes the
|
If set, this parameter causes the
|
||||||
.Ic posix
|
.Ic posix
|
||||||
@ -1541,7 +1503,7 @@ below.
|
|||||||
The process ID of the shell's parent (read-only).
|
The process ID of the shell's parent (read-only).
|
||||||
.It Ev PS1
|
.It Ev PS1
|
||||||
The primary prompt for interactive shells.
|
The primary prompt for interactive shells.
|
||||||
Parameter, command, and arithmetic
|
Parameter, command and arithmetic
|
||||||
substitutions are performed, and
|
substitutions are performed, and
|
||||||
.Ql \&!
|
.Ql \&!
|
||||||
is replaced with the current command number (see the
|
is replaced with the current command number (see the
|
||||||
@ -1573,8 +1535,7 @@ for root.
|
|||||||
Since Backslashes and other special characters may be
|
Since Backslashes and other special characters may be
|
||||||
interpreted by the shell, to set
|
interpreted by the shell, to set
|
||||||
.Ev PS1
|
.Ev PS1
|
||||||
either escape the backslash itself,
|
either escape the backslash itself or use double quotes.
|
||||||
or use double quotes.
|
|
||||||
The latter is more practical.
|
The latter is more practical.
|
||||||
This is a more complex example which embeds the current working
|
This is a more complex example which embeds the current working
|
||||||
directory, in reverse video, into the prompt string, avoiding to
|
directory, in reverse video, into the prompt string, avoiding to
|
||||||
@ -1582,8 +1543,8 @@ directly enter special characters (for example with
|
|||||||
.Ic ^^
|
.Ic ^^
|
||||||
in the emacs editing mode):
|
in the emacs editing mode):
|
||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ x=$(print \e\e001)
|
x=$(print \e\e001)
|
||||||
$ PS1="$x$(print \e\er)$x$(tput so)$x\e$PWD$x$(tput se)$x> "
|
PS1="$x$(print \e\er)$x$(tput so)$x\e$PWD$x$(tput se)$x> "
|
||||||
.Ed
|
.Ed
|
||||||
.It Ev PS2
|
.It Ev PS2
|
||||||
Secondary prompt string, by default
|
Secondary prompt string, by default
|
||||||
@ -1599,7 +1560,7 @@ Default is
|
|||||||
Used to prefix commands that are printed during execution tracing (see the
|
Used to prefix commands that are printed during execution tracing (see the
|
||||||
.Ic set Fl x
|
.Ic set Fl x
|
||||||
command below).
|
command below).
|
||||||
Parameter, command, and arithmetic substitutions are performed
|
Parameter, command and arithmetic substitutions are performed
|
||||||
before it is printed.
|
before it is printed.
|
||||||
Default is
|
Default is
|
||||||
.Dq \&+\ \& .
|
.Dq \&+\ \& .
|
||||||
@ -1645,7 +1606,7 @@ If the time is exceeded, the shell exits.
|
|||||||
.It Ev TMPDIR
|
.It Ev TMPDIR
|
||||||
The directory shell temporary files are created in.
|
The directory shell temporary files are created in.
|
||||||
If this parameter is not
|
If this parameter is not
|
||||||
set, or does not contain the absolute path of a writable directory, temporary
|
set or does not contain the absolute path of a writable directory, temporary
|
||||||
files are created in
|
files are created in
|
||||||
.Pa /tmp .
|
.Pa /tmp .
|
||||||
.It Ev VISUAL
|
.It Ev VISUAL
|
||||||
@ -1702,16 +1663,17 @@ and login names are also delimited by colons.
|
|||||||
The home directory of previously expanded login names are cached and re-used.
|
The home directory of previously expanded login names are cached and re-used.
|
||||||
The
|
The
|
||||||
.Ic alias -d
|
.Ic alias -d
|
||||||
command may be used to list, change, and add to this cache (e.g.,
|
command may be used to list, change and add to this cache (e.g.,
|
||||||
.Ic alias -d fac=/usr/local/facilities; cd ~fac/bin ) .
|
.Ic alias -d fac=/usr/local/facilities; cd ~fac/bin ) .
|
||||||
.Ss Brace expansion (alteration)
|
.Ss Brace expansion (alteration)
|
||||||
Brace expressions, which take the form
|
Brace expressions, which take the form
|
||||||
.Pp
|
.Bd -unfilled -offset indent
|
||||||
.Sm off
|
.Sm off
|
||||||
.D1 Xo Ar prefix Ic { Ar str No 1,...,
|
.Xo Ar prefix Ic { Ar str No 1,...,
|
||||||
.Ar str No N Ic } Ar suffix
|
.Ar str No N Ic } Ar suffix
|
||||||
.Xc
|
.Xc
|
||||||
.Sm on
|
.Sm on
|
||||||
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
are expanded to N words, each of which is the concatenation of
|
are expanded to N words, each of which is the concatenation of
|
||||||
.Ar prefix ,
|
.Ar prefix ,
|
||||||
@ -1894,8 +1856,8 @@ inside a
|
|||||||
.Ic \&[ Ns .. Ns Ic \&]
|
.Ic \&[ Ns .. Ns Ic \&]
|
||||||
expression) are not yet implemented.
|
expression) are not yet implemented.
|
||||||
.Ss Input/output redirection
|
.Ss Input/output redirection
|
||||||
When a command is executed, its standard input, standard output, and standard
|
When a command is executed, its standard input, standard output and standard
|
||||||
error (file descriptors 0, 1, and 2, respectively) are normally inherited from
|
error (file descriptors 0, 1 and 2, respectively) are normally inherited from
|
||||||
the shell.
|
the shell.
|
||||||
Three exceptions to this are commands in pipelines, for which
|
Three exceptions to this are commands in pipelines, for which
|
||||||
standard input and/or standard output are those set up by the pipeline,
|
standard input and/or standard output are those set up by the pipeline,
|
||||||
@ -1956,7 +1918,7 @@ If
|
|||||||
.Ar marker
|
.Ar marker
|
||||||
contains no quoted characters, the contents of the temporary file are processed
|
contains no quoted characters, the contents of the temporary file are processed
|
||||||
as if enclosed in double quotes each time the command is executed, so
|
as if enclosed in double quotes each time the command is executed, so
|
||||||
parameter, command, and arithmetic substitutions are performed, along with
|
parameter, command and arithmetic substitutions are performed, along with
|
||||||
backslash
|
backslash
|
||||||
.Pq Sq \e
|
.Pq Sq \e
|
||||||
escapes for
|
escapes for
|
||||||
@ -1991,8 +1953,8 @@ except the operation is done on standard output.
|
|||||||
In any of the above redirections, the file descriptor that is redirected (i.e.,
|
In any of the above redirections, the file descriptor that is redirected (i.e.,
|
||||||
standard input or standard output) can be explicitly given by preceding the
|
standard input or standard output) can be explicitly given by preceding the
|
||||||
redirection with a single digit.
|
redirection with a single digit.
|
||||||
Parameter, command, and arithmetic
|
Parameter, command and arithmetic
|
||||||
substitutions, tilde substitutions, and (if the shell is interactive)
|
substitutions, tilde substitutions and, if the shell is interactive,
|
||||||
file name generation are all performed on the
|
file name generation are all performed on the
|
||||||
.Ar file ,
|
.Ar file ,
|
||||||
.Ar marker
|
.Ar marker
|
||||||
@ -2029,7 +1991,7 @@ expressions, inside array references (e.g.,
|
|||||||
.Sm on
|
.Sm on
|
||||||
as numeric arguments to the
|
as numeric arguments to the
|
||||||
.Ic test
|
.Ic test
|
||||||
command, and as the value of an assignment to an integer parameter.
|
command and as the value of an assignment to an integer parameter.
|
||||||
.Pp
|
.Pp
|
||||||
Expressions may contain alpha-numeric parameter identifiers, array references
|
Expressions may contain alpha-numeric parameter identifiers, array references
|
||||||
and integer constants and may be combined with the following C operators
|
and integer constants and may be combined with the following C operators
|
||||||
@ -2087,7 +2049,7 @@ Integer constants may be specified with arbitrary bases using the notation
|
|||||||
.Ar base Ns Ic \&# Ns Ar number ,
|
.Ar base Ns Ic \&# Ns Ar number ,
|
||||||
where
|
where
|
||||||
.Ar base
|
.Ar base
|
||||||
is a decimal integer specifying the base, and
|
is a decimal integer specifying the base and
|
||||||
.Ar number
|
.Ar number
|
||||||
is a number in the specified base.
|
is a number in the specified base.
|
||||||
.Pp
|
.Pp
|
||||||
@ -2169,7 +2131,7 @@ See
|
|||||||
Shift left (right); the result is the left argument with its bits shifted left
|
Shift left (right); the result is the left argument with its bits shifted left
|
||||||
(right) by the amount given in the right argument.
|
(right) by the amount given in the right argument.
|
||||||
.It Ic \&+ \&- \&* /
|
.It Ic \&+ \&- \&* /
|
||||||
Addition, subtraction, multiplication, and division.
|
Addition, subtraction, multiplication and division.
|
||||||
.It Ic %
|
.It Ic %
|
||||||
Remainder; the result is the remainder of the division of the left argument by
|
Remainder; the result is the remainder of the division of the left argument by
|
||||||
the right.
|
the right.
|
||||||
@ -2177,8 +2139,7 @@ The sign of the result is unspecified if either argument is negative.
|
|||||||
.It Xo Ao Ar arg1 Ac Ic \ \&?
|
.It Xo Ao Ar arg1 Ac Ic \ \&?
|
||||||
.Ao Ar arg2 Ac Ic \ \&: Ao Ar arg3 Ac
|
.Ao Ar arg2 Ac Ic \ \&: Ao Ar arg3 Ac
|
||||||
.Xc
|
.Xc
|
||||||
If
|
.No If Ao Ar arg1 Ac
|
||||||
.Ao Ar arg1 Ac
|
|
||||||
is non-zero, the result is
|
is non-zero, the result is
|
||||||
.Ao Ar arg2 Ac ,
|
.Ao Ar arg2 Ac ,
|
||||||
otherwise
|
otherwise
|
||||||
@ -2197,7 +2158,7 @@ and
|
|||||||
.Ic \&<\&&p
|
.Ic \&<\&&p
|
||||||
redirections, respectively.
|
redirections, respectively.
|
||||||
Once a co-process has been started, another can't
|
Once a co-process has been started, another can't
|
||||||
be started until the co-process exits, or until the co-process's input has been
|
be started until the co-process exits or the co-process's input has been
|
||||||
redirected using an
|
redirected using an
|
||||||
.Ic exec Ar n Ns Ic \&>\&&p
|
.Ic exec Ar n Ns Ic \&>\&&p
|
||||||
redirection.
|
redirection.
|
||||||
@ -2250,11 +2211,10 @@ However, unlike
|
|||||||
.Li .-scripts ,
|
.Li .-scripts ,
|
||||||
shell arguments (i.e., positional parameters
|
shell arguments (i.e., positional parameters
|
||||||
.Ic $1 , $2 ,
|
.Ic $1 , $2 ,
|
||||||
etc.) are never visible
|
etc.) are never visible inside them.
|
||||||
inside them.
|
|
||||||
When the shell is determining the location of a command, functions
|
When the shell is determining the location of a command, functions
|
||||||
are searched after special built-in commands, before regular and
|
are searched after special built-in commands, before regular and
|
||||||
non-regular built-ins, and before the
|
non-regular built-ins and before the
|
||||||
.Ev PATH
|
.Ev PATH
|
||||||
is searched.
|
is searched.
|
||||||
.Pp
|
.Pp
|
||||||
@ -2427,11 +2387,9 @@ In
|
|||||||
mode, signal names are listed one per line; in
|
mode, signal names are listed one per line; in
|
||||||
.Pf non- Tn POSIX
|
.Pf non- Tn POSIX
|
||||||
mode,
|
mode,
|
||||||
signal numbers, names, and descriptions are printed in columns.
|
signal numbers, names and descriptions are printed in columns.
|
||||||
In the future, a new option
|
In the future, a new option
|
||||||
.Po Fl v
|
.Pq Fl v No perhaps
|
||||||
\ perhaps
|
|
||||||
.Pc
|
|
||||||
will be added to distinguish the two behaviours.
|
will be added to distinguish the two behaviours.
|
||||||
.It
|
.It
|
||||||
.Ic fg
|
.Ic fg
|
||||||
@ -2531,7 +2489,7 @@ In
|
|||||||
mode, normal argument expansion is done; in
|
mode, normal argument expansion is done; in
|
||||||
.Pf non- Tn POSIX
|
.Pf non- Tn POSIX
|
||||||
mode,
|
mode,
|
||||||
field splitting, file globbing, brace expansion, and (normal) tilde expansion
|
field splitting, file globbing, brace expansion and (normal) tilde expansion
|
||||||
are turned off, while assignment tilde expansion is turned on.
|
are turned off, while assignment tilde expansion is turned on.
|
||||||
.It
|
.It
|
||||||
Signal specification.
|
Signal specification.
|
||||||
@ -2541,7 +2499,7 @@ mode, signals can be specified as digits, only
|
|||||||
if signal numbers match
|
if signal numbers match
|
||||||
.Tn POSIX
|
.Tn POSIX
|
||||||
values (i.e., HUP=1, INT=2, QUIT=3, ABRT=6,
|
values (i.e., HUP=1, INT=2, QUIT=3, ABRT=6,
|
||||||
KILL=9, ALRM=14, and TERM=15); in
|
KILL=9, ALRM=14 and TERM=15); in
|
||||||
.Pf non- Tn POSIX
|
.Pf non- Tn POSIX
|
||||||
mode, signals can always be digits.
|
mode, signals can always be digits.
|
||||||
.It
|
.It
|
||||||
@ -2594,10 +2552,45 @@ argument to the
|
|||||||
.Fl t
|
.Fl t
|
||||||
test may be left out and defaults to 1).
|
test may be left out and defaults to 1).
|
||||||
.El
|
.El
|
||||||
|
.Ss Strict Bourne shell mode
|
||||||
|
When the
|
||||||
|
.Ic sh
|
||||||
|
option is enabled (see the
|
||||||
|
.Ic set
|
||||||
|
command),
|
||||||
|
.Nm
|
||||||
|
will behave like
|
||||||
|
.Xr sh 1
|
||||||
|
in the following ways:
|
||||||
|
.Bl -bullet
|
||||||
|
.It
|
||||||
|
The parameter
|
||||||
|
.Ic $_
|
||||||
|
is not set to
|
||||||
|
.Bl -dash
|
||||||
|
.It
|
||||||
|
the expanded alias' full program path after entering commands
|
||||||
|
that are tracked aliases
|
||||||
|
.It
|
||||||
|
the last argument on the command line after entering external
|
||||||
|
commands
|
||||||
|
.El
|
||||||
|
.It
|
||||||
|
File descriptors are left untouched when executing
|
||||||
|
.Ic exec
|
||||||
|
with no arguments.
|
||||||
|
.It
|
||||||
|
Backslash-escaped special characters are not substituted in
|
||||||
|
.Ev PS1 .
|
||||||
|
.It
|
||||||
|
Sequences of
|
||||||
|
.Sq Li (( Ns Ar ... Ns Li ))
|
||||||
|
are not interpreted as arithmetic expressions.
|
||||||
|
.El
|
||||||
.Ss Command execution
|
.Ss Command execution
|
||||||
After evaluation of command-line arguments, redirections, and parameter
|
After evaluation of command-line arguments, redirections and parameter
|
||||||
assignments, the type of command is determined: a special built-in, a
|
assignments, the type of command is determined: a special built-in, a
|
||||||
function, a regular built-in, or the name of a file to execute found using the
|
function, a regular built-in or the name of a file to execute found using the
|
||||||
.Ev PATH
|
.Ev PATH
|
||||||
parameter.
|
parameter.
|
||||||
The checks are made in the above order.
|
The checks are made in the above order.
|
||||||
@ -2725,7 +2718,7 @@ option sets
|
|||||||
.Po Ic \&+x
|
.Po Ic \&+x
|
||||||
\ clears
|
\ clears
|
||||||
.Pc
|
.Pc
|
||||||
the export attribute of an alias, or, if no names are given, lists the aliases
|
the export attribute of an alias or, if no names are given, lists the aliases
|
||||||
with the export attribute (exporting an alias has no effect).
|
with the export attribute (exporting an alias has no effect).
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
@ -2750,15 +2743,60 @@ is assumed.
|
|||||||
This command is only available on systems which support job control (see
|
This command is only available on systems which support job control (see
|
||||||
.Sx Job control
|
.Sx Job control
|
||||||
below for more information).
|
below for more information).
|
||||||
.It Xo
|
.It Ic bind Op Fl l
|
||||||
.Ic bind Op Fl m
|
The current bindings or, if the
|
||||||
.Oo Ar key
|
.Fl l
|
||||||
.Op Ns = Ns Ar editing-command
|
flag is given,
|
||||||
.Ar ... Oc
|
the names of the functions to which keys may be bound, are listed.
|
||||||
.Xc
|
See
|
||||||
Set or view the current emacs command editing key bindings/macros (see
|
|
||||||
.Sx Emacs editing mode
|
.Sx Emacs editing mode
|
||||||
below for a complete description).
|
for more information.
|
||||||
|
.It Xo Ic bind Op Fl m
|
||||||
|
.Ar string Ns = Ns Op Ar substitute
|
||||||
|
.Ar ...
|
||||||
|
.Xc
|
||||||
|
.It Xo Ic bind
|
||||||
|
.Ar string Ns = Ns Op Ar editing-command
|
||||||
|
.Ar ...
|
||||||
|
.Xc
|
||||||
|
The specified editing command is bound to the given
|
||||||
|
.Ar string ,
|
||||||
|
which should consist of a control character (which may be written using caret
|
||||||
|
notation, i.e., ^X), optionally preceded by one of the two prefix characters.
|
||||||
|
If the
|
||||||
|
.Fl m
|
||||||
|
flag is given, the specified input
|
||||||
|
.Ar string
|
||||||
|
will afterwards be immediately replaced by the given
|
||||||
|
.Ar substitute
|
||||||
|
string, which may contain editing commands.
|
||||||
|
.Pp
|
||||||
|
Future input of the
|
||||||
|
.Ar string
|
||||||
|
will cause the editing command to be immediately invoked.
|
||||||
|
Note that although only two prefix characters (usually
|
||||||
|
.Tn ESC
|
||||||
|
and ^X) are supported, some
|
||||||
|
multi-character sequences can be supported.
|
||||||
|
The following binds the arrow keys on an
|
||||||
|
.Tn ANSI
|
||||||
|
terminal or
|
||||||
|
.Xr xterm 1
|
||||||
|
(these are in the default bindings).
|
||||||
|
Of course some escape sequences won't work out quite this nicely.
|
||||||
|
.Pp
|
||||||
|
.Bl -item -compact
|
||||||
|
.It
|
||||||
|
.Ic bind '^[['=prefix-2
|
||||||
|
.It
|
||||||
|
.Ic bind '^XA'=up-history
|
||||||
|
.It
|
||||||
|
.Ic bind '^XB'=down-history
|
||||||
|
.It
|
||||||
|
.Ic bind '^XC'=forward-char
|
||||||
|
.It
|
||||||
|
.Ic bind '^XD'=backward-char
|
||||||
|
.El
|
||||||
.It Ic break Op Ar level
|
.It Ic break Op Ar level
|
||||||
Exit the
|
Exit the
|
||||||
.Ar level Ns th
|
.Ar level Ns th
|
||||||
@ -2801,7 +2839,7 @@ is used.
|
|||||||
If
|
If
|
||||||
.Ar dir
|
.Ar dir
|
||||||
is
|
is
|
||||||
.Dq - ,
|
.Ql - ,
|
||||||
the previous working directory is used (see
|
the previous working directory is used (see
|
||||||
.Ev OLDPWD
|
.Ev OLDPWD
|
||||||
parameter).
|
parameter).
|
||||||
@ -2845,7 +2883,7 @@ If neither the
|
|||||||
.Fl v
|
.Fl v
|
||||||
nor
|
nor
|
||||||
.Fl V
|
.Fl V
|
||||||
options are given,
|
option is given,
|
||||||
.Ar cmd
|
.Ar cmd
|
||||||
is executed exactly as if
|
is executed exactly as if
|
||||||
.Ic command
|
.Ic command
|
||||||
@ -2861,8 +2899,7 @@ option is given, a default search path is used instead of the current value of
|
|||||||
.Ev PATH
|
.Ev PATH
|
||||||
(the actual value of the default path is system dependent: on
|
(the actual value of the default path is system dependent: on
|
||||||
.Tn POSIX Ns ish
|
.Tn POSIX Ns ish
|
||||||
systems,
|
systems, it is the value returned by
|
||||||
it is the value returned by
|
|
||||||
.Ic getconf CS_PATH ) .
|
.Ic getconf CS_PATH ) .
|
||||||
.Pp
|
.Pp
|
||||||
If the
|
If the
|
||||||
@ -2959,7 +2996,7 @@ commands defining all exported parameters, including their values, are printed.
|
|||||||
.It Ic false
|
.It Ic false
|
||||||
A command that exits with a non-zero status.
|
A command that exits with a non-zero status.
|
||||||
.It Xo Ic fc
|
.It Xo Ic fc
|
||||||
.Oo Fl e Ar editor No \&|
|
.Oo Fl e Ar editor \*(Ba
|
||||||
.Fl l Op Fl n Oc
|
.Fl l Op Fl n Oc
|
||||||
.Op Fl r
|
.Op Fl r
|
||||||
.Op Ar first Op Ar last
|
.Op Ar first Op Ar last
|
||||||
@ -3079,7 +3116,7 @@ invoked).
|
|||||||
.Pp
|
.Pp
|
||||||
Warning: Changing the value of the shell parameter
|
Warning: Changing the value of the shell parameter
|
||||||
.Ev OPTIND
|
.Ev OPTIND
|
||||||
to a value other than 1, or parsing different sets of arguments without
|
to a value other than 1 or parsing different sets of arguments without
|
||||||
resetting
|
resetting
|
||||||
.Ev OPTIND
|
.Ev OPTIND
|
||||||
may lead to unexpected results.
|
may lead to unexpected results.
|
||||||
@ -3121,7 +3158,7 @@ and the displayed job.
|
|||||||
.Ar pid |
|
.Ar pid |
|
||||||
.Ar pgrp No } Ar ...
|
.Ar pgrp No } Ar ...
|
||||||
.Xc
|
.Xc
|
||||||
Send the specified signal to the specified jobs, process IDs, or process
|
Send the specified signal to the specified jobs, process IDs or process
|
||||||
groups.
|
groups.
|
||||||
If no signal is specified, the
|
If no signal is specified, the
|
||||||
.Dv TERM
|
.Dv TERM
|
||||||
@ -3237,7 +3274,7 @@ using the
|
|||||||
.Ev IFS
|
.Ev IFS
|
||||||
parameter (see
|
parameter (see
|
||||||
.Sx Substitution
|
.Sx Substitution
|
||||||
above), and assigns each field to the specified parameters.
|
above) and assigns each field to the specified parameters.
|
||||||
If there are more parameters than fields, the extra parameters are set to
|
If there are more parameters than fields, the extra parameters are set to
|
||||||
.Dv NULL ,
|
.Dv NULL ,
|
||||||
or alternatively, if there are more fields than parameters, the last parameter
|
or alternatively, if there are more fields than parameters, the last parameter
|
||||||
@ -3323,7 +3360,7 @@ command can be used to set
|
|||||||
.Pq Ic \&-
|
.Pq Ic \&-
|
||||||
or clear
|
or clear
|
||||||
.Pq Ic \&+
|
.Pq Ic \&+
|
||||||
shell options, set the positional parameters, or set an array parameter.
|
shell options, set the positional parameters or set an array parameter.
|
||||||
Options can be changed using the
|
Options can be changed using the
|
||||||
.Ic \&+ Ns Fl o Ar option
|
.Ic \&+ Ns Fl o Ar option
|
||||||
syntax, where
|
syntax, where
|
||||||
@ -3510,8 +3547,13 @@ mode.
|
|||||||
See
|
See
|
||||||
.Sx POSIX mode
|
.Sx POSIX mode
|
||||||
above.
|
above.
|
||||||
|
.It Ic sh
|
||||||
|
Enable strict Bourne shell mode (see
|
||||||
|
.Sx Strict Bourne shell mode ) .
|
||||||
.It Ic vi
|
.It Ic vi
|
||||||
Enable vi-like command-line editing (interactive shells only).
|
Enable
|
||||||
|
.Xr vi 1 Ns -like
|
||||||
|
command-line editing (interactive shells only).
|
||||||
.It Ic viraw
|
.It Ic viraw
|
||||||
No effect.
|
No effect.
|
||||||
In the original Korn shell, unless
|
In the original Korn shell, unless
|
||||||
@ -3815,10 +3857,10 @@ If a
|
|||||||
.Ar pipeline
|
.Ar pipeline
|
||||||
is given, the times used to execute the pipeline are reported.
|
is given, the times used to execute the pipeline are reported.
|
||||||
If no pipeline
|
If no pipeline
|
||||||
is given, then the user and system time used by the shell itself, and all the
|
is given, then the user and system time used by the shell itself and all the
|
||||||
commands it has run since it was started, are reported.
|
commands it has run since it was started is reported.
|
||||||
The times reported are the real time (elapsed time from start to finish),
|
The times reported are the real time (elapsed time from start to finish),
|
||||||
the user CPU time (time spent running in user mode), and the system CPU time
|
the user CPU time (time spent running in user mode) and the system CPU time
|
||||||
(time spent running in kernel mode).
|
(time spent running in kernel mode).
|
||||||
Times are reported to standard error; the format of the output is:
|
Times are reported to standard error; the format of the output is:
|
||||||
.Pp
|
.Pp
|
||||||
@ -3836,7 +3878,8 @@ is a simple command), in which case the output is slightly longer:
|
|||||||
.Pp
|
.Pp
|
||||||
(the number of digits after the decimal may vary from system to system).
|
(the number of digits after the decimal may vary from system to system).
|
||||||
Note
|
Note
|
||||||
that simple redirections of standard error do not effect the output of the time
|
that simple redirections of standard error do not effect the output of the
|
||||||
|
.Ic time
|
||||||
command:
|
command:
|
||||||
.Pp
|
.Pp
|
||||||
.Dl time sleep 1 2> afile
|
.Dl time sleep 1 2> afile
|
||||||
@ -3858,9 +3901,9 @@ string, indicating the signals are to be ignored, a minus sign
|
|||||||
.Pq Sq \&- ,
|
.Pq Sq \&- ,
|
||||||
indicating that the default action is to be taken for the signals (see
|
indicating that the default action is to be taken for the signals (see
|
||||||
.Xr signal 3 )
|
.Xr signal 3 )
|
||||||
or a string containing shell commands to be evaluated and executed at the first
|
or a string containing shell commands to be evaluated and executed at the
|
||||||
opportunity (i.e., when the current command completes, or before printing the
|
first opportunity (i.e., when the current command completes or before
|
||||||
next
|
printing the next
|
||||||
.Ev PS1
|
.Ev PS1
|
||||||
prompt) after receipt of one of the signals.
|
prompt) after receipt of one of the signals.
|
||||||
.Ar signal
|
.Ar signal
|
||||||
@ -4141,7 +4184,7 @@ is concerned, a block is 512 bytes.
|
|||||||
.It Xo Ic umask Op Fl S
|
.It Xo Ic umask Op Fl S
|
||||||
.Op Ar mask
|
.Op Ar mask
|
||||||
.Xc
|
.Xc
|
||||||
Display or set the file permission creation mask, or umask (see
|
Display or set the file permission creation mask or umask (see
|
||||||
.Xr umask 2 ) .
|
.Xr umask 2 ) .
|
||||||
If the
|
If the
|
||||||
.Fl S
|
.Fl S
|
||||||
@ -4155,7 +4198,7 @@ octal masks in which a set bit means the corresponding bit is to be cleared).
|
|||||||
For example,
|
For example,
|
||||||
.Dq ug=rwx,o=
|
.Dq ug=rwx,o=
|
||||||
sets the mask so files will not be readable, writable or executable by
|
sets the mask so files will not be readable, writable or executable by
|
||||||
.Dq others ,
|
.Dq others
|
||||||
and is equivalent (on most systems) to the octal mask
|
and is equivalent (on most systems) to the octal mask
|
||||||
.Dq 007 .
|
.Dq 007 .
|
||||||
.It Xo Ic unalias Op Fl adt
|
.It Xo Ic unalias Op Fl adt
|
||||||
@ -4190,7 +4233,7 @@ The exit status of
|
|||||||
is that of the last specified job; if the last job is killed by a signal, the
|
is that of the last specified job; if the last job is killed by a signal, the
|
||||||
exit status is 128 + the number of the signal (see
|
exit status is 128 + the number of the signal (see
|
||||||
.Ic kill -l Ar exit-status
|
.Ic kill -l Ar exit-status
|
||||||
above); if the last specified job can't be found (because it never existed, or
|
above); if the last specified job can't be found (because it never existed or
|
||||||
had already finished), the exit status of
|
had already finished), the exit status of
|
||||||
.Ic wait
|
.Ic wait
|
||||||
is 127.
|
is 127.
|
||||||
@ -4199,7 +4242,7 @@ See
|
|||||||
below for the format of
|
below for the format of
|
||||||
.Ar job .
|
.Ar job .
|
||||||
.Ic wait
|
.Ic wait
|
||||||
will return if a signal for which a trap has been set is received, or if a
|
will return if a signal for which a trap has been set is received or if a
|
||||||
.Dv SIGHUP ,
|
.Dv SIGHUP ,
|
||||||
.Dv SIGINT
|
.Dv SIGINT
|
||||||
or
|
or
|
||||||
@ -4218,7 +4261,7 @@ If job monitoring is enabled, the completion status of jobs is printed
|
|||||||
For each
|
For each
|
||||||
.Ar name ,
|
.Ar name ,
|
||||||
the type of command is listed (reserved word, built-in, alias,
|
the type of command is listed (reserved word, built-in, alias,
|
||||||
function, tracked alias, or executable).
|
function, tracked alias or executable).
|
||||||
If the
|
If the
|
||||||
.Fl p
|
.Fl p
|
||||||
option is used, a path search is performed even if
|
option is used, a path search is performed even if
|
||||||
@ -4272,7 +4315,7 @@ commands, and the state of the terminal is saved or restored when a foreground
|
|||||||
job is stopped or restarted, respectively.
|
job is stopped or restarted, respectively.
|
||||||
.Pp
|
.Pp
|
||||||
Note that only commands that create processes (e.g., asynchronous commands,
|
Note that only commands that create processes (e.g., asynchronous commands,
|
||||||
subshell commands, and non-built-in, non-function commands) can be stopped;
|
subshell commands and non-built-in, non-function commands) can be stopped;
|
||||||
commands like
|
commands like
|
||||||
.Ic read
|
.Ic read
|
||||||
cannot be.
|
cannot be.
|
||||||
@ -4297,7 +4340,7 @@ parameter) or by prefixing the job number with a percent sign
|
|||||||
Other percent sequences can also be used to refer to jobs:
|
Other percent sequences can also be used to refer to jobs:
|
||||||
.Bl -tag -width 10n
|
.Bl -tag -width 10n
|
||||||
.It Ic %\&+
|
.It Ic %\&+
|
||||||
The most recently stopped job, or, if there are no stopped jobs, the oldest
|
The most recently stopped job or, if there are no stopped jobs, the oldest
|
||||||
running job.
|
running job.
|
||||||
.It Ic %% , %
|
.It Ic %% , %
|
||||||
Same as
|
Same as
|
||||||
@ -4440,60 +4483,15 @@ In the emacs mode, various editing commands
|
|||||||
(typically bound to one or more control characters) cause immediate actions
|
(typically bound to one or more control characters) cause immediate actions
|
||||||
without waiting for a newline.
|
without waiting for a newline.
|
||||||
Several editing commands are bound to particular
|
Several editing commands are bound to particular
|
||||||
control characters when the shell is invoked; these binding can be changed
|
control characters when the shell is invoked; these bindings can be changed
|
||||||
using the following commands:
|
using the
|
||||||
.Bl -tag -width Ds
|
.Ic bind
|
||||||
.It Ic bind
|
command.
|
||||||
The current bindings are listed.
|
|
||||||
.It Xo Ic bind
|
|
||||||
.Ar string Ns = Ns Op Ar editing-command
|
|
||||||
.Xc
|
|
||||||
The specified editing command is bound to the given
|
|
||||||
.Ar string ,
|
|
||||||
which should consist of a control character (which may be written using caret
|
|
||||||
notation, i.e., ^X), optionally preceded by one of the two prefix characters.
|
|
||||||
Future input of the
|
|
||||||
.Ar string
|
|
||||||
will cause the editing command to be immediately invoked.
|
|
||||||
Note that although only two prefix characters (usually
|
|
||||||
.Tn ESC
|
|
||||||
and ^X) are supported, some
|
|
||||||
multi-character sequences can be supported.
|
|
||||||
The following binds the arrow keys on an
|
|
||||||
.Tn ANSI
|
|
||||||
terminal, or xterm (these are in the default bindings).
|
|
||||||
Of course some escape sequences won't work out quite this nicely.
|
|
||||||
.Pp
|
|
||||||
.Bl -item -compact
|
|
||||||
.It
|
|
||||||
.Ic bind '^[['=prefix-2
|
|
||||||
.It
|
|
||||||
.Ic bind '^XA'=up-history
|
|
||||||
.It
|
|
||||||
.Ic bind '^XB'=down-history
|
|
||||||
.It
|
|
||||||
.Ic bind '^XC'=forward-char
|
|
||||||
.It
|
|
||||||
.Ic bind '^XD'=backward-char
|
|
||||||
.El
|
|
||||||
.It Ic bind Fl l
|
|
||||||
Lists the names of the functions to which keys may be bound.
|
|
||||||
.It Xo Ic bind Fl m
|
|
||||||
.Sm off
|
|
||||||
.Ar string No = Op Ar substitute
|
|
||||||
.Sm on
|
|
||||||
.Xc
|
|
||||||
The specified input
|
|
||||||
.Ar string
|
|
||||||
will afterwards be immediately replaced by the given
|
|
||||||
.Ar substitute
|
|
||||||
string, which may contain editing commands.
|
|
||||||
.El
|
|
||||||
.Pp
|
.Pp
|
||||||
The following is a list of available editing commands.
|
The following is a list of available editing commands.
|
||||||
Each description starts with the name of the command, an
|
Each description starts with the name of the command, an
|
||||||
.Ar n
|
.Ar n
|
||||||
(if the command can be prefixed with a count), and any keys the command is
|
(if the command can be prefixed with a count) and any keys the command is
|
||||||
bound to by default (written using caret notation, i.e.,
|
bound to by default (written using caret notation, i.e.,
|
||||||
.Tn "ASCII ESC"
|
.Tn "ASCII ESC"
|
||||||
character is
|
character is
|
||||||
@ -4545,7 +4543,7 @@ Uppercase the first character in the next
|
|||||||
.Ar n
|
.Ar n
|
||||||
words, leaving the cursor past the end of the last word.
|
words, leaving the cursor past the end of the last word.
|
||||||
.Pp
|
.Pp
|
||||||
If the current line does not being with a comment character, one is added at
|
If the current line does not begin with a comment character, one is added at
|
||||||
the beginning of the line and the line is entered (as if return had been
|
the beginning of the line and the line is entered (as if return had been
|
||||||
pressed); otherwise, the existing comment characters are removed and the cursor
|
pressed); otherwise, the existing comment characters are removed and the cursor
|
||||||
is placed at the beginning of the line.
|
is placed at the beginning of the line.
|
||||||
@ -4729,7 +4727,7 @@ Acts like
|
|||||||
.Ic stuff ,
|
.Ic stuff ,
|
||||||
then aborts input the same as an interrupt.
|
then aborts input the same as an interrupt.
|
||||||
.It Ic transpose-chars ^T
|
.It Ic transpose-chars ^T
|
||||||
If at the end of line, or if the
|
If at the end of line or if the
|
||||||
.Ic gmacs
|
.Ic gmacs
|
||||||
option is set, this exchanges the two previous characters; otherwise, it
|
option is set, this exchanges the two previous characters; otherwise, it
|
||||||
exchanges the previous and current characters and moves the cursor one
|
exchanges the previous and current characters and moves the cursor one
|
||||||
@ -4743,7 +4741,8 @@ Uppercase the next
|
|||||||
.Ar n
|
.Ar n
|
||||||
words.
|
words.
|
||||||
.It Ic version ^V
|
.It Ic version ^V
|
||||||
Display the version of ksh.
|
Display the version of
|
||||||
|
.Nm mksh .
|
||||||
The current edit buffer is restored as soon as any
|
The current edit buffer is restored as soon as any
|
||||||
key is pressed (the key is then processed, unless it is a space).
|
key is pressed (the key is then processed, unless it is a space).
|
||||||
.It Ic yank ^Y
|
.It Ic yank ^Y
|
||||||
@ -4754,8 +4753,9 @@ Immediately after a
|
|||||||
replaces the inserted text string with the next previously killed text string.
|
replaces the inserted text string with the next previously killed text string.
|
||||||
.El
|
.El
|
||||||
.Ss Vi editing mode
|
.Ss Vi editing mode
|
||||||
The vi command-line editor in ksh has basically the same commands as the vi
|
The vi command-line editor in
|
||||||
editor (see
|
.Nm
|
||||||
|
has basically the same commands as the vi editor (see
|
||||||
.Xr vi 1 ) ,
|
.Xr vi 1 ) ,
|
||||||
with the following exceptions:
|
with the following exceptions:
|
||||||
.Bl -bullet
|
.Bl -bullet
|
||||||
@ -4772,7 +4772,9 @@ and, optionally,
|
|||||||
.It
|
.It
|
||||||
The
|
The
|
||||||
.Ic _
|
.Ic _
|
||||||
command is different (in ksh it is the last argument command, in vi it goes to
|
command is different (in
|
||||||
|
.Nm
|
||||||
|
it is the last argument command, in vi it goes to
|
||||||
the start of the current line).
|
the start of the current line).
|
||||||
.It
|
.It
|
||||||
The
|
The
|
||||||
@ -4792,7 +4794,7 @@ commands, etc.).
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
Note that the ^X stands for control-X; also <esc>, <space> and <tab> are used
|
Note that the ^X stands for control-X; also <esc>, <space> and <tab> are used
|
||||||
for escape, space, and tab, respectively (no kidding).
|
for escape, space and tab, respectively (no kidding).
|
||||||
.Pp
|
.Pp
|
||||||
Like vi, there are two modes \(em
|
Like vi, there are two modes \(em
|
||||||
.Dq insert
|
.Dq insert
|
||||||
@ -4807,7 +4809,7 @@ In particular, the following characters are taken from current
|
|||||||
settings (see
|
settings (see
|
||||||
.Xr tty 1 )
|
.Xr tty 1 )
|
||||||
and have their usual meaning (normal values are in parentheses): kill (^U),
|
and have their usual meaning (normal values are in parentheses): kill (^U),
|
||||||
erase (^?), werase (^W), eof (^D), intr (^C), and quit (^\e).
|
erase (^?), werase (^W), eof (^D), intr (^C) and quit (^\e).
|
||||||
In addition to
|
In addition to
|
||||||
the above, the following characters are also treated specially in insert mode:
|
the above, the following characters are also treated specially in insert mode:
|
||||||
.Bl -tag -width 10n
|
.Bl -tag -width 10n
|
||||||
@ -4819,7 +4821,7 @@ The next character typed is not treated specially (can be used
|
|||||||
to insert the characters being described here).
|
to insert the characters being described here).
|
||||||
.It Ic ^J ^M
|
.It Ic ^J ^M
|
||||||
End of line.
|
End of line.
|
||||||
The current line is read, parsed, and executed by the shell.
|
The current line is read, parsed and executed by the shell.
|
||||||
.It Ic <esc>
|
.It Ic <esc>
|
||||||
Puts the editor in command mode (see below).
|
Puts the editor in command mode (see below).
|
||||||
.It Ic ^E
|
.It Ic ^E
|
||||||
@ -4840,7 +4842,7 @@ above), enabled with
|
|||||||
.Pp
|
.Pp
|
||||||
In command mode, each character is interpreted as a command.
|
In command mode, each character is interpreted as a command.
|
||||||
Characters that
|
Characters that
|
||||||
don't correspond to commands, are illegal combinations of commands, or are
|
don't correspond to commands, are illegal combinations of commands or are
|
||||||
commands that can't be carried out all cause beeps.
|
commands that can't be carried out all cause beeps.
|
||||||
In the following command descriptions, an
|
In the following command descriptions, an
|
||||||
.Ar n
|
.Ar n
|
||||||
@ -4855,14 +4857,16 @@ refers to the position between the cursor and the character preceding the
|
|||||||
cursor.
|
cursor.
|
||||||
A
|
A
|
||||||
.Dq word
|
.Dq word
|
||||||
is a sequence of letters, digits, and underscore characters or a sequence of
|
is a sequence of letters, digits and underscore characters or a sequence of
|
||||||
non-letter, non-digit, non-underscore, non-whitespace characters (e.g.,
|
non-letter, non-digit, non-underscore, non-whitespace characters (e.g.,
|
||||||
.Dq ab2\&*\&&^
|
.Dq ab2\&*\&&^
|
||||||
contains two words) and a
|
contains two words) and a
|
||||||
.Dq big-word
|
.Dq big-word
|
||||||
is a sequence of non-whitespace characters.
|
is a sequence of non-whitespace characters.
|
||||||
.Pp
|
.Pp
|
||||||
Special ksh vi commands
|
Special
|
||||||
|
.Nm
|
||||||
|
vi commands
|
||||||
.Pp
|
.Pp
|
||||||
The following commands are not in, or are different from, the normal vi file
|
The following commands are not in, or are different from, the normal vi file
|
||||||
editor:
|
editor:
|
||||||
@ -4898,7 +4902,7 @@ The actual command executed is
|
|||||||
Command or file name expansion is applied to the current big-word (with an
|
Command or file name expansion is applied to the current big-word (with an
|
||||||
appended
|
appended
|
||||||
.Ql * ,
|
.Ql * ,
|
||||||
if the word contains no file globbing characters) -- the big-word is replaced
|
if the word contains no file globbing characters) \(em the big-word is replaced
|
||||||
with the resulting words.
|
with the resulting words.
|
||||||
If the current big-word is the first on the line (or
|
If the current big-word is the first on the line (or
|
||||||
follows one of the characters
|
follows one of the characters
|
||||||
@ -4920,7 +4924,13 @@ File name expansion matches the big-word against the files in the
|
|||||||
current directory.
|
current directory.
|
||||||
After expansion, the cursor is placed just past the last
|
After expansion, the cursor is placed just past the last
|
||||||
word and the editor is in insert mode.
|
word and the editor is in insert mode.
|
||||||
.It n\e,\ n^F,\ n<tab>,\ and\ n<esc>
|
.It Xo
|
||||||
|
.Ar n Ns Ic \e Ns ,
|
||||||
|
.Ar n Ns Ic ^F ,
|
||||||
|
.Ar n Ns Ic <tab> ,
|
||||||
|
.No and
|
||||||
|
.Ar n Ns Ic <esc>
|
||||||
|
.Xc
|
||||||
Command/file name completion.
|
Command/file name completion.
|
||||||
Replace the current big-word with the
|
Replace the current big-word with the
|
||||||
longest unique match obtained after performing command and file name expansion.
|
longest unique match obtained after performing command and file name expansion.
|
||||||
@ -5039,11 +5049,21 @@ command, but moves in the opposite direction.
|
|||||||
.Pp
|
.Pp
|
||||||
Inter-line movement commands:
|
Inter-line movement commands:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It \fIn\fBj\fR,\ \fIn\fB+\fR\ and\ \fIn\fB^N\fR
|
.It Xo
|
||||||
|
.Ar n Ns Ic j ,
|
||||||
|
.Ar n Ns Ic +
|
||||||
|
.No and
|
||||||
|
.Ar n Ns Ic ^N
|
||||||
|
.Xc
|
||||||
Move to the
|
Move to the
|
||||||
.Ar n Ns th
|
.Ar n Ns th
|
||||||
next line in the history.
|
next line in the history.
|
||||||
.It \fIn\fBk\fR,\ \fIn\fB-\fR\ and\ \fIn\fB^P\fR
|
.It Xo
|
||||||
|
.Ar n Ns Ic k ,
|
||||||
|
.Ar n Ns Ic -
|
||||||
|
.No and
|
||||||
|
.Ar n Ns Ic ^P
|
||||||
|
.Xc
|
||||||
Move to the
|
Move to the
|
||||||
.Ar n Ns th
|
.Ar n Ns th
|
||||||
previous line in the history.
|
previous line in the history.
|
||||||
@ -5183,7 +5203,7 @@ except the buffer is pasted at the current position.
|
|||||||
Miscellaneous vi commands
|
Miscellaneous vi commands
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Ic ^J No and Ic ^M
|
.It Ic ^J No and Ic ^M
|
||||||
The current line is read, parsed, and executed by the shell.
|
The current line is read, parsed and executed by the shell.
|
||||||
.It Ic ^L No and Ic ^R
|
.It Ic ^L No and Ic ^R
|
||||||
Redraw the current line.
|
Redraw the current line.
|
||||||
.It Ar n Ns Ic \&.
|
.It Ar n Ns Ic \&.
|
||||||
@ -5301,7 +5321,7 @@ Please include the version of
|
|||||||
.Ic print $KSH_VERSION
|
.Ic print $KSH_VERSION
|
||||||
shows it
|
shows it
|
||||||
.Pc ,
|
.Pc ,
|
||||||
the machine, operating system, and compiler you are using and how you built
|
the machine, operating system and compiler you are using and how you built
|
||||||
.Nm
|
.Nm
|
||||||
(it is recommended to use the provided
|
(it is recommended to use the provided
|
||||||
.Pa Build.sh
|
.Pa Build.sh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user