- 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 $
|
||||
.\" $OpenBSD: ksh.1tbl,v 1.79 2004/12/04 07:05:13 jaredy Exp $
|
||||
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.8 2004/12/31 18:22:54 tg 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 $
|
||||
.\"
|
||||
.\" Copyright (c) 1980, 1990, 1993
|
||||
.\" 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
|
||||
.\" Public Domain.
|
||||
.\"
|
||||
.Dd November 10, 2004
|
||||
.Dt KSH 1
|
||||
@ -140,7 +111,7 @@ An interactive shell has job control enabled (if available), ignores the
|
||||
.Dv SIGQUIT
|
||||
and
|
||||
.Dv SIGTERM
|
||||
signals, and prints prompts before reading input (see
|
||||
signals and prints prompts before reading input (see
|
||||
.Ev PS1
|
||||
and
|
||||
.Ev PS2
|
||||
@ -250,7 +221,7 @@ If the
|
||||
.Ev ENV
|
||||
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,
|
||||
command, arithmetic, and tilde
|
||||
command, arithmetic and tilde
|
||||
.Pq Sq \&~
|
||||
substitution and the resulting file
|
||||
(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
|
||||
occurred during the execution of a script.
|
||||
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.
|
||||
.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 .
|
||||
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
|
||||
.Ql < ,
|
||||
.Ql > ,
|
||||
@ -352,7 +323,7 @@ the
|
||||
.Ql #
|
||||
up to the nearest newline is ignored;
|
||||
.Ql $
|
||||
is used to introduce parameter, command, and arithmetic substitutions (see
|
||||
is used to introduce parameter, command and arithmetic substitutions (see
|
||||
.Sx Substitution
|
||||
below);
|
||||
.Ql `
|
||||
@ -389,7 +360,7 @@ such as
|
||||
.Ic for
|
||||
and
|
||||
.Ic if
|
||||
statements, grouping constructs, and function definitions.
|
||||
statements, grouping constructs and function definitions.
|
||||
.Pp
|
||||
A simple-command consists of some combination of parameter assignments
|
||||
(see
|
||||
@ -515,21 +486,12 @@ These words
|
||||
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
|
||||
redirections):
|
||||
.Pp
|
||||
.\" .TS
|
||||
.\" center;
|
||||
.\" lfB lfB lfB lfB lfB .
|
||||
.\" case else function then !
|
||||
.\" do esac if time [[
|
||||
.\" 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 \&! , \&[\&[ , \&{ , \&}
|
||||
.Bd -literal -offset center
|
||||
case else function then !
|
||||
do esac if time [[
|
||||
done fi in until {
|
||||
elif for select while }
|
||||
.Ed
|
||||
.Pp
|
||||
.Sy Note:
|
||||
Some shells (but not this one) execute control structure commands in a
|
||||
@ -542,7 +504,7 @@ control structure.
|
||||
.Pp
|
||||
In the following compound command descriptions, command lists (denoted as
|
||||
.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.
|
||||
For example,
|
||||
.Bd -unfilled -offset indent
|
||||
@ -600,7 +562,7 @@ are dropped.
|
||||
Note that any unquoted space before and after a pattern is
|
||||
stripped; any space within a pattern must be quoted.
|
||||
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.
|
||||
For historical reasons, open and close braces may be used instead of
|
||||
.Ic in
|
||||
@ -700,7 +662,7 @@ standard input,
|
||||
.Ar name
|
||||
is set to the selected word (or unset if the selection is not valid),
|
||||
.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
|
||||
is executed.
|
||||
If a blank line (i.e., zero or more
|
||||
@ -715,7 +677,7 @@ is
|
||||
.Dv NULL ,
|
||||
the prompt is printed and so on.
|
||||
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
|
||||
statement is executed inside the loop.
|
||||
If
|
||||
@ -842,7 +804,7 @@ operators must always be used (e.g., instead of
|
||||
use
|
||||
.Ic \&[[ Fl n Ar str Ic \&]] ) .
|
||||
.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
|
||||
.Ql &&
|
||||
and
|
||||
@ -850,10 +812,10 @@ and
|
||||
operators.
|
||||
This means that in the statement
|
||||
.Pp
|
||||
.Ic \&[[ -r foo && $(< foo) = b*r ]]
|
||||
.Dl Ic "[[ -r foo && $(<foo) = b*r ]]"
|
||||
.Pp
|
||||
the
|
||||
.Ic $(< foo)
|
||||
.Ic $(<foo)
|
||||
is evaluated if and only if the file
|
||||
.Pa foo
|
||||
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.
|
||||
The next
|
||||
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
|
||||
.Ic alias -t .
|
||||
Note that changing the
|
||||
@ -981,7 +943,7 @@ and
|
||||
The first step the shell takes in executing a simple-command is to perform
|
||||
substitutions on the words of the command.
|
||||
There are three kinds of
|
||||
substitution: parameter, command, and arithmetic.
|
||||
substitution: parameter, command and arithmetic.
|
||||
Parameter substitutions,
|
||||
which are described in detail in the next section, take the form
|
||||
.Ic $ Ns Ar name
|
||||
@ -1002,7 +964,7 @@ parameter.
|
||||
The
|
||||
.Ev IFS
|
||||
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
|
||||
.Ev IFS
|
||||
characters are called
|
||||
@ -1038,7 +1000,7 @@ Note that if the
|
||||
.Ev IFS
|
||||
parameter is set to the null
|
||||
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
|
||||
The results of substitution are, unless otherwise specified, also subject to
|
||||
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.
|
||||
A parameter name is either one
|
||||
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
|
||||
.Ql _
|
||||
counts as a letter
|
||||
.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
|
||||
.Op Ar expr
|
||||
where
|
||||
@ -1177,7 +1139,7 @@ Parameters with the export attribute (set using the
|
||||
.Ic export
|
||||
or
|
||||
.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
|
||||
.Xr environ 7 )
|
||||
of commands run by the shell as
|
||||
@ -1250,7 +1212,7 @@ being set (as opposed to set and not
|
||||
.Dv NULL ) .
|
||||
If
|
||||
.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
|
||||
.Ar word
|
||||
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.
|
||||
A single
|
||||
.Ql #
|
||||
results in the shortest match, and two
|
||||
of them result in the longest match.
|
||||
results in the shortest match, two of them result in the longest match.
|
||||
.Sm off
|
||||
.It Xo
|
||||
.Ic ${ Ar name Ic % Ar pattern
|
||||
@ -1411,7 +1372,7 @@ Currently set to the
|
||||
value as reported by
|
||||
.Xr stty 1
|
||||
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 set Fl o
|
||||
and
|
||||
@ -1511,7 +1472,7 @@ Not yet implemented.
|
||||
The previous working directory.
|
||||
Unset if
|
||||
.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.
|
||||
.It Ev OPTARG
|
||||
When using
|
||||
@ -1530,6 +1491,7 @@ An empty string resulting from a leading or trailing
|
||||
colon, or two adjacent colons, is treated as a
|
||||
.Dq \&. ,
|
||||
the current directory.
|
||||
This is dangerous.
|
||||
.It Ev POSIXLY_CORRECT
|
||||
If set, this parameter causes the
|
||||
.Ic posix
|
||||
@ -1541,7 +1503,7 @@ below.
|
||||
The process ID of the shell's parent (read-only).
|
||||
.It Ev PS1
|
||||
The primary prompt for interactive shells.
|
||||
Parameter, command, and arithmetic
|
||||
Parameter, command and arithmetic
|
||||
substitutions are performed, and
|
||||
.Ql \&!
|
||||
is replaced with the current command number (see the
|
||||
@ -1573,8 +1535,7 @@ for root.
|
||||
Since Backslashes and other special characters may be
|
||||
interpreted by the shell, to set
|
||||
.Ev PS1
|
||||
either escape the backslash itself,
|
||||
or use double quotes.
|
||||
either escape the backslash itself or use double quotes.
|
||||
The latter is more practical.
|
||||
This is a more complex example which embeds the current working
|
||||
directory, in reverse video, into the prompt string, avoiding to
|
||||
@ -1582,8 +1543,8 @@ directly enter special characters (for example with
|
||||
.Ic ^^
|
||||
in the emacs editing mode):
|
||||
.Bd -literal -offset indent
|
||||
$ x=$(print \e\e001)
|
||||
$ PS1="$x$(print \e\er)$x$(tput so)$x\e$PWD$x$(tput se)$x> "
|
||||
x=$(print \e\e001)
|
||||
PS1="$x$(print \e\er)$x$(tput so)$x\e$PWD$x$(tput se)$x> "
|
||||
.Ed
|
||||
.It Ev PS2
|
||||
Secondary prompt string, by default
|
||||
@ -1599,7 +1560,7 @@ Default is
|
||||
Used to prefix commands that are printed during execution tracing (see the
|
||||
.Ic set Fl x
|
||||
command below).
|
||||
Parameter, command, and arithmetic substitutions are performed
|
||||
Parameter, command and arithmetic substitutions are performed
|
||||
before it is printed.
|
||||
Default is
|
||||
.Dq \&+\ \& .
|
||||
@ -1645,7 +1606,7 @@ If the time is exceeded, the shell exits.
|
||||
.It Ev TMPDIR
|
||||
The directory shell temporary files are created in.
|
||||
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
|
||||
.Pa /tmp .
|
||||
.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
|
||||
.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 ) .
|
||||
.Ss Brace expansion (alteration)
|
||||
Brace expressions, which take the form
|
||||
.Pp
|
||||
.Bd -unfilled -offset indent
|
||||
.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
|
||||
.Xc
|
||||
.Sm on
|
||||
.Ed
|
||||
.Pp
|
||||
are expanded to N words, each of which is the concatenation of
|
||||
.Ar prefix ,
|
||||
@ -1894,8 +1856,8 @@ inside a
|
||||
.Ic \&[ Ns .. Ns Ic \&]
|
||||
expression) are not yet implemented.
|
||||
.Ss Input/output redirection
|
||||
When a command is executed, its standard input, standard output, and standard
|
||||
error (file descriptors 0, 1, and 2, respectively) are normally inherited from
|
||||
When a command is executed, its standard input, standard output and standard
|
||||
error (file descriptors 0, 1 and 2, respectively) are normally inherited from
|
||||
the shell.
|
||||
Three exceptions to this are commands in pipelines, for which
|
||||
standard input and/or standard output are those set up by the pipeline,
|
||||
@ -1956,7 +1918,7 @@ If
|
||||
.Ar marker
|
||||
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
|
||||
parameter, command, and arithmetic substitutions are performed, along with
|
||||
parameter, command and arithmetic substitutions are performed, along with
|
||||
backslash
|
||||
.Pq Sq \e
|
||||
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.,
|
||||
standard input or standard output) can be explicitly given by preceding the
|
||||
redirection with a single digit.
|
||||
Parameter, command, and arithmetic
|
||||
substitutions, tilde substitutions, and (if the shell is interactive)
|
||||
Parameter, command and arithmetic
|
||||
substitutions, tilde substitutions and, if the shell is interactive,
|
||||
file name generation are all performed on the
|
||||
.Ar file ,
|
||||
.Ar marker
|
||||
@ -2029,7 +1991,7 @@ expressions, inside array references (e.g.,
|
||||
.Sm on
|
||||
as numeric arguments to the
|
||||
.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
|
||||
Expressions may contain alpha-numeric parameter identifiers, array references
|
||||
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 ,
|
||||
where
|
||||
.Ar base
|
||||
is a decimal integer specifying the base, and
|
||||
is a decimal integer specifying the base and
|
||||
.Ar number
|
||||
is a number in the specified base.
|
||||
.Pp
|
||||
@ -2169,7 +2131,7 @@ See
|
||||
Shift left (right); the result is the left argument with its bits shifted left
|
||||
(right) by the amount given in the right argument.
|
||||
.It Ic \&+ \&- \&* /
|
||||
Addition, subtraction, multiplication, and division.
|
||||
Addition, subtraction, multiplication and division.
|
||||
.It Ic %
|
||||
Remainder; the result is the remainder of the division of the left argument by
|
||||
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 \ \&?
|
||||
.Ao Ar arg2 Ac Ic \ \&: Ao Ar arg3 Ac
|
||||
.Xc
|
||||
If
|
||||
.Ao Ar arg1 Ac
|
||||
.No If Ao Ar arg1 Ac
|
||||
is non-zero, the result is
|
||||
.Ao Ar arg2 Ac ,
|
||||
otherwise
|
||||
@ -2197,7 +2158,7 @@ and
|
||||
.Ic \&<\&&p
|
||||
redirections, respectively.
|
||||
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
|
||||
.Ic exec Ar n Ns Ic \&>\&&p
|
||||
redirection.
|
||||
@ -2250,11 +2211,10 @@ However, unlike
|
||||
.Li .-scripts ,
|
||||
shell arguments (i.e., positional parameters
|
||||
.Ic $1 , $2 ,
|
||||
etc.) are never visible
|
||||
inside them.
|
||||
etc.) are never visible inside them.
|
||||
When the shell is determining the location of a command, functions
|
||||
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
|
||||
is searched.
|
||||
.Pp
|
||||
@ -2427,11 +2387,9 @@ In
|
||||
mode, signal names are listed one per line; in
|
||||
.Pf non- Tn POSIX
|
||||
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
|
||||
.Po Fl v
|
||||
\ perhaps
|
||||
.Pc
|
||||
.Pq Fl v No perhaps
|
||||
will be added to distinguish the two behaviours.
|
||||
.It
|
||||
.Ic fg
|
||||
@ -2531,7 +2489,7 @@ In
|
||||
mode, normal argument expansion is done; in
|
||||
.Pf non- Tn POSIX
|
||||
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.
|
||||
.It
|
||||
Signal specification.
|
||||
@ -2541,7 +2499,7 @@ mode, signals can be specified as digits, only
|
||||
if signal numbers match
|
||||
.Tn POSIX
|
||||
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
|
||||
mode, signals can always be digits.
|
||||
.It
|
||||
@ -2594,10 +2552,45 @@ argument to the
|
||||
.Fl t
|
||||
test may be left out and defaults to 1).
|
||||
.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
|
||||
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
|
||||
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
|
||||
parameter.
|
||||
The checks are made in the above order.
|
||||
@ -2725,7 +2718,7 @@ option sets
|
||||
.Po Ic \&+x
|
||||
\ clears
|
||||
.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).
|
||||
.Pp
|
||||
The
|
||||
@ -2750,15 +2743,60 @@ is assumed.
|
||||
This command is only available on systems which support job control (see
|
||||
.Sx Job control
|
||||
below for more information).
|
||||
.It Xo
|
||||
.Ic bind Op Fl m
|
||||
.Oo Ar key
|
||||
.Op Ns = Ns Ar editing-command
|
||||
.Ar ... Oc
|
||||
.Xc
|
||||
Set or view the current emacs command editing key bindings/macros (see
|
||||
.It Ic bind Op Fl l
|
||||
The current bindings or, if the
|
||||
.Fl l
|
||||
flag is given,
|
||||
the names of the functions to which keys may be bound, are listed.
|
||||
See
|
||||
.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
|
||||
Exit the
|
||||
.Ar level Ns th
|
||||
@ -2801,7 +2839,7 @@ is used.
|
||||
If
|
||||
.Ar dir
|
||||
is
|
||||
.Dq - ,
|
||||
.Ql - ,
|
||||
the previous working directory is used (see
|
||||
.Ev OLDPWD
|
||||
parameter).
|
||||
@ -2845,7 +2883,7 @@ If neither the
|
||||
.Fl v
|
||||
nor
|
||||
.Fl V
|
||||
options are given,
|
||||
option is given,
|
||||
.Ar cmd
|
||||
is executed exactly as if
|
||||
.Ic command
|
||||
@ -2861,8 +2899,7 @@ option is given, a default search path is used instead of the current value of
|
||||
.Ev PATH
|
||||
(the actual value of the default path is system dependent: on
|
||||
.Tn POSIX Ns ish
|
||||
systems,
|
||||
it is the value returned by
|
||||
systems, it is the value returned by
|
||||
.Ic getconf CS_PATH ) .
|
||||
.Pp
|
||||
If the
|
||||
@ -2959,7 +2996,7 @@ commands defining all exported parameters, including their values, are printed.
|
||||
.It Ic false
|
||||
A command that exits with a non-zero status.
|
||||
.It Xo Ic fc
|
||||
.Oo Fl e Ar editor No \&|
|
||||
.Oo Fl e Ar editor \*(Ba
|
||||
.Fl l Op Fl n Oc
|
||||
.Op Fl r
|
||||
.Op Ar first Op Ar last
|
||||
@ -3079,7 +3116,7 @@ invoked).
|
||||
.Pp
|
||||
Warning: Changing the value of the shell parameter
|
||||
.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
|
||||
.Ev OPTIND
|
||||
may lead to unexpected results.
|
||||
@ -3121,7 +3158,7 @@ and the displayed job.
|
||||
.Ar pid |
|
||||
.Ar pgrp No } Ar ...
|
||||
.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.
|
||||
If no signal is specified, the
|
||||
.Dv TERM
|
||||
@ -3237,7 +3274,7 @@ using the
|
||||
.Ev IFS
|
||||
parameter (see
|
||||
.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
|
||||
.Dv NULL ,
|
||||
or alternatively, if there are more fields than parameters, the last parameter
|
||||
@ -3323,7 +3360,7 @@ command can be used to set
|
||||
.Pq Ic \&-
|
||||
or clear
|
||||
.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
|
||||
.Ic \&+ Ns Fl o Ar option
|
||||
syntax, where
|
||||
@ -3510,8 +3547,13 @@ mode.
|
||||
See
|
||||
.Sx POSIX mode
|
||||
above.
|
||||
.It Ic sh
|
||||
Enable strict Bourne shell mode (see
|
||||
.Sx Strict Bourne shell mode ) .
|
||||
.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
|
||||
No effect.
|
||||
In the original Korn shell, unless
|
||||
@ -3815,10 +3857,10 @@ If a
|
||||
.Ar pipeline
|
||||
is given, the times used to execute the pipeline are reported.
|
||||
If no pipeline
|
||||
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.
|
||||
is given, then the user and system time used by the shell itself and all the
|
||||
commands it has run since it was started is reported.
|
||||
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).
|
||||
Times are reported to standard error; the format of the output is:
|
||||
.Pp
|
||||
@ -3836,7 +3878,8 @@ is a simple command), in which case the output is slightly longer:
|
||||
.Pp
|
||||
(the number of digits after the decimal may vary from system to system).
|
||||
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:
|
||||
.Pp
|
||||
.Dl time sleep 1 2> afile
|
||||
@ -3858,9 +3901,9 @@ string, indicating the signals are to be ignored, a minus sign
|
||||
.Pq Sq \&- ,
|
||||
indicating that the default action is to be taken for the signals (see
|
||||
.Xr signal 3 )
|
||||
or a string containing shell commands to be evaluated and executed at the first
|
||||
opportunity (i.e., when the current command completes, or before printing the
|
||||
next
|
||||
or a string containing shell commands to be evaluated and executed at the
|
||||
first opportunity (i.e., when the current command completes or before
|
||||
printing the next
|
||||
.Ev PS1
|
||||
prompt) after receipt of one of the signals.
|
||||
.Ar signal
|
||||
@ -4141,7 +4184,7 @@ is concerned, a block is 512 bytes.
|
||||
.It Xo Ic umask Op Fl S
|
||||
.Op Ar mask
|
||||
.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 ) .
|
||||
If the
|
||||
.Fl S
|
||||
@ -4155,7 +4198,7 @@ octal masks in which a set bit means the corresponding bit is to be cleared).
|
||||
For example,
|
||||
.Dq ug=rwx,o=
|
||||
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
|
||||
.Dq 007 .
|
||||
.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
|
||||
exit status is 128 + the number of the signal (see
|
||||
.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
|
||||
.Ic wait
|
||||
is 127.
|
||||
@ -4199,7 +4242,7 @@ See
|
||||
below for the format of
|
||||
.Ar job .
|
||||
.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 SIGINT
|
||||
or
|
||||
@ -4218,7 +4261,7 @@ If job monitoring is enabled, the completion status of jobs is printed
|
||||
For each
|
||||
.Ar name ,
|
||||
the type of command is listed (reserved word, built-in, alias,
|
||||
function, tracked alias, or executable).
|
||||
function, tracked alias or executable).
|
||||
If the
|
||||
.Fl p
|
||||
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.
|
||||
.Pp
|
||||
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
|
||||
.Ic read
|
||||
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:
|
||||
.Bl -tag -width 10n
|
||||
.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.
|
||||
.It Ic %% , %
|
||||
Same as
|
||||
@ -4440,60 +4483,15 @@ In the emacs mode, various editing commands
|
||||
(typically bound to one or more control characters) cause immediate actions
|
||||
without waiting for a newline.
|
||||
Several editing commands are bound to particular
|
||||
control characters when the shell is invoked; these binding can be changed
|
||||
using the following commands:
|
||||
.Bl -tag -width Ds
|
||||
.It Ic bind
|
||||
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
|
||||
control characters when the shell is invoked; these bindings can be changed
|
||||
using the
|
||||
.Ic bind
|
||||
command.
|
||||
.Pp
|
||||
The following is a list of available editing commands.
|
||||
Each description starts with the name of the command, an
|
||||
.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.,
|
||||
.Tn "ASCII ESC"
|
||||
character is
|
||||
@ -4545,7 +4543,7 @@ Uppercase the first character in the next
|
||||
.Ar n
|
||||
words, leaving the cursor past the end of the last word.
|
||||
.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
|
||||
pressed); otherwise, the existing comment characters are removed and the cursor
|
||||
is placed at the beginning of the line.
|
||||
@ -4729,7 +4727,7 @@ Acts like
|
||||
.Ic stuff ,
|
||||
then aborts input the same as an interrupt.
|
||||
.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
|
||||
option is set, this exchanges the two previous characters; otherwise, it
|
||||
exchanges the previous and current characters and moves the cursor one
|
||||
@ -4743,7 +4741,8 @@ Uppercase the next
|
||||
.Ar n
|
||||
words.
|
||||
.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
|
||||
key is pressed (the key is then processed, unless it is a space).
|
||||
.It Ic yank ^Y
|
||||
@ -4754,8 +4753,9 @@ Immediately after a
|
||||
replaces the inserted text string with the next previously killed text string.
|
||||
.El
|
||||
.Ss Vi editing mode
|
||||
The vi command-line editor in ksh has basically the same commands as the vi
|
||||
editor (see
|
||||
The vi command-line editor in
|
||||
.Nm
|
||||
has basically the same commands as the vi editor (see
|
||||
.Xr vi 1 ) ,
|
||||
with the following exceptions:
|
||||
.Bl -bullet
|
||||
@ -4772,7 +4772,9 @@ and, optionally,
|
||||
.It
|
||||
The
|
||||
.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).
|
||||
.It
|
||||
The
|
||||
@ -4792,7 +4794,7 @@ commands, etc.).
|
||||
.El
|
||||
.Pp
|
||||
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
|
||||
Like vi, there are two modes \(em
|
||||
.Dq insert
|
||||
@ -4807,7 +4809,7 @@ In particular, the following characters are taken from current
|
||||
settings (see
|
||||
.Xr tty 1 )
|
||||
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
|
||||
the above, the following characters are also treated specially in insert mode:
|
||||
.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).
|
||||
.It Ic ^J ^M
|
||||
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>
|
||||
Puts the editor in command mode (see below).
|
||||
.It Ic ^E
|
||||
@ -4840,7 +4842,7 @@ above), enabled with
|
||||
.Pp
|
||||
In command mode, each character is interpreted as a command.
|
||||
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.
|
||||
In the following command descriptions, an
|
||||
.Ar n
|
||||
@ -4855,14 +4857,16 @@ refers to the position between the cursor and the character preceding the
|
||||
cursor.
|
||||
A
|
||||
.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.,
|
||||
.Dq ab2\&*\&&^
|
||||
contains two words) and a
|
||||
.Dq big-word
|
||||
is a sequence of non-whitespace characters.
|
||||
.Pp
|
||||
Special ksh vi commands
|
||||
Special
|
||||
.Nm
|
||||
vi commands
|
||||
.Pp
|
||||
The following commands are not in, or are different from, the normal vi file
|
||||
editor:
|
||||
@ -4898,7 +4902,7 @@ The actual command executed is
|
||||
Command or file name expansion is applied to the current big-word (with an
|
||||
appended
|
||||
.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.
|
||||
If the current big-word is the first on the line (or
|
||||
follows one of the characters
|
||||
@ -4920,7 +4924,13 @@ File name expansion matches the big-word against the files in the
|
||||
current directory.
|
||||
After expansion, the cursor is placed just past the last
|
||||
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.
|
||||
Replace the current big-word with the
|
||||
longest unique match obtained after performing command and file name expansion.
|
||||
@ -5039,11 +5049,21 @@ command, but moves in the opposite direction.
|
||||
.Pp
|
||||
Inter-line movement commands:
|
||||
.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
|
||||
.Ar n Ns th
|
||||
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
|
||||
.Ar n Ns th
|
||||
previous line in the history.
|
||||
@ -5183,7 +5203,7 @@ except the buffer is pasted at the current position.
|
||||
Miscellaneous vi commands
|
||||
.Bl -tag -width Ds
|
||||
.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
|
||||
Redraw the current line.
|
||||
.It Ar n Ns Ic \&.
|
||||
@ -5301,7 +5321,7 @@ Please include the version of
|
||||
.Ic print $KSH_VERSION
|
||||
shows it
|
||||
.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
|
||||
(it is recommended to use the provided
|
||||
.Pa Build.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user