-.\" $OpenBSD: cat.1,v 1.17 2000/03/02 04:17:50 aaron Exp $
+.\" $OpenBSD: cat.1,v 1.18 2000/03/17 18:15:11 aaron Exp $
.\" $NetBSD: cat.1,v 1.12 1995/09/27 05:38:55 cgd Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
Displays non-printing characters so they are visible.
Control characters print as
.Ql ^X
-for control-X. The only exception is the tab character, control-I (see the
+for control-X.
+The only exception is the tab character, control-I (see the
.Fl t
-option). The
+option).
+The
.Tn DEL
character (octal 0177) prints as
.Ql ^? .
.Ar file3 ,
truncating
.Ar file3
-if it already exists. See the manual page for your shell
-.Po
-i.e.,
-.Xr sh 1
-.Pc
+if it already exists.
+See the manual page for your shell (i.e.,
+.Xr sh 1 )
for more information on redirection.
.Pp
The command:
-.\" $OpenBSD: chio.1,v 1.13 1999/08/17 14:03:59 aaron Exp $
+.\" $OpenBSD: chio.1,v 1.14 2000/03/17 18:15:12 aaron Exp $
.\" $NetBSD: chio.1,v 1.1.1.1 1996/04/03 00:34:38 thorpej Exp $
.\"
.\" Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>
.Pa portal
(import/export), and
.Pa drive
-(data transfer). In this command description, the shorthand
+(data transfer).
+In this command description, the shorthand
.Sq ET
will be used to represent an element type, and
.Sq EU
-will be used to represent an element unit. For example, to represent
+will be used to represent an element unit.
+For example, to represent
the first robotic arm in the changer, the ET would be
.Dq picker
and the EU would be
.Op Ar inv1
.Op Ar inv2
.Pp
-Performs a media unit exchange operation. The media unit in
+Performs a media unit exchange operation.
+The media unit in
.Aq Ar src ET/EU
is moved to
.Aq Ar dst1 ET/EU
.Cm chio status
.Op Aq Ar type
.Pp
-Report the status of all elements in the changer. If
+Report the status of all elements in the changer.
+If
.Aq Ar type
is specified, report the status of all elements of type
.Aq Ar type .
-.\" $OpenBSD: chmod.1,v 1.15 1999/09/23 09:56:53 aaron Exp $
+.\" $OpenBSD: chmod.1,v 1.16 2000/03/17 18:15:12 aaron Exp $
.\" $NetBSD: chmod.1,v 1.8 1995/03/21 09:02:07 cgd Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993, 1994
utility modifies the file mode bits of the listed files
as specified by the
.Ar mode
-operand. The mode of a file dictates its permissions, among other attributes.
+operand.
+The mode of a file dictates its permissions, among other attributes.
.Pp
The options are as follows:
.Bl -tag -width Ds
.Pp
The execute bit for a directory is often referred to as the
.Dq search
-bit. In order to access a file, a user must have execute permission in each
-directory leading up to it in the filesystem hierarchy. For example, to access
-the file
+bit.
+In order to access a file, a user must have execute permission in each
+directory leading up to it in the filesystem hierarchy.
+For example, to access the file
.Pa /bin/ls ,
execute permission is needed on
.Pa / ,
.Pp
Deny write permission to group and others.
.Pp
-.Dl Ic chmod go-w file
+.Dl Ic chmod go-w file
.Pp
Set the read and write permissions to the usual defaults, but
retain any execute permissions that are currently set.
.Pp
-.Dl Ic chmod =rw,+X file
+.Dl Ic chmod =rw,+X file
.Pp
Make a directory or file searchable/executable by everyone if it is
already searchable/executable by anyone.
.Pp
-.Dl Ic chmod +X file
+.Dl Ic chmod +X file
.Pp
Any of the following will make a file readable/executable by everyone and
writable by the owner only.
.Pp
-.Dl Ic chmod 755 file
-.Dl Ic chmod u=rwx,go=rx file
-.Dl Ic chmod u=rwx,go=u-w file
+.Dl Ic chmod 755 file
+.Dl Ic chmod u=rwx,go=rx file
+.Dl Ic chmod u=rwx,go=u-w file
.Pp
Clear all mode bits for group and others.
.Pp
-.Dl Ic chmod go= file
+.Dl Ic chmod go= file
.Pp
Set the group bits equal to the user bits, but clear the group write bit.
.Pp
-.Dl Ic chmod g=u-w file
+.Dl Ic chmod g=u-w file
.Sh SEE ALSO
.Xr chgrp 1 ,
.Xr find 1 ,
-.\" $OpenBSD: cp.1,v 1.13 1999/09/23 19:27:35 aaron Exp $
+.\" $OpenBSD: cp.1,v 1.14 2000/03/17 18:15:11 aaron Exp $
.\" $NetBSD: cp.1,v 1.9 1995/07/25 19:36:45 jtc Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993, 1994
.It Fl f
For each existing destination pathname, remove it and
create a new file, without prompting for confirmation,
-regardless of its permissions. This option overrides any use of
+regardless of its permissions.
+This option overrides any use of
.Fl i .
.It Fl i
Write a prompt to the standard error output before copying a file
-.\" $OpenBSD: csh.1,v 1.32 2000/01/18 21:03:43 aaron Exp $
+.\" $OpenBSD: csh.1,v 1.33 2000/03/17 18:15:12 aaron Exp $
.\" $NetBSD: csh.1,v 1.10 1995/03/21 09:02:35 cgd Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
interactive file name
and user name completion (see
.Sx File name completion ) ,
-and a C-like syntax. It is used both as an interactive
+and a C-like syntax.
+It is used both as an interactive
login shell and a shell script command processor.
.Ss Argument list processing
If the first argument (argument 0) to the shell is a dash
.It Fl m
Read
.Pa \&.cshrc ,
-regardless of its owner and group. This option is dangerous and should only
-be used by
+regardless of its owner and group.
+This option is dangerous and should only be used by
.Xr su 1 .
.It Fl n
Commands are parsed, but not executed.
-This aids in syntactic checking of shell scripts. When used interactively, the
+This aids in syntactic checking of shell scripts.
+When used interactively, the
shell can be terminated by pressing control-D (end-of-file character), since
.Ic exit
will not work.
.Ss Jobs
The shell associates a
.Em job
-with each pipeline. It keeps
-a table of current jobs, printed by the
+with each pipeline.
+It keeps a table of current jobs, printed by the
.Ic jobs
-command, and assigns them small integer numbers. When
-a job is started asynchronously with
+command, and assigns them small integer numbers.
+When a job is started asynchronously with
.Ql & ,
the shell prints a line that looks
like:
signal to the current job.
The shell will then normally show that the job has been
.Dq Stopped ,
-and print another prompt. You can then manipulate the state of this job,
-putting it in the
+and print another prompt.
+You can then manipulate the state of this job, putting it in the
.Em background
with the
.Ic bg
.Ic ^Z
takes effect immediately and
is like an interrupt in that pending output and unread input are discarded
-when it is typed. There is another special key
+when it is typed.
+There is another special key
.Ic ^Y
that does not generate a
.Dv SIGSTOP
for a job that you wish to stop after it has read them.
.Pp
A job being run in the background will stop if it tries to read
-from the terminal. Background jobs are normally allowed to produce output,
+from the terminal.
+Background jobs are normally allowed to produce output,
but this can be disabled by giving the command
.Ic stty tostop .
If you set this
tty option, then background jobs will stop when they try to produce
output like they do when they try to read input.
.Pp
-There are several ways to refer to jobs in the shell. The character
+There are several ways to refer to jobs in the shell.
+The character
.Ql %
-introduces a job name. If you wish to refer to job number 1, you can
-name it as
+introduces a job name.
+If you wish to refer to job number 1, you can name it as
.Ql %1 .
Just naming a job brings it to the foreground; thus
.Ic %1
.Ql %+
refers to the current job and
.Ql %\-
-refers to the previous job. For close
-analogy with the syntax of the
+refers to the previous job.
+For close analogy with the syntax of the
.Ic history
mechanism (described below),
.Ql %%
.Xr stty 1
option
.Ic new
-be set. It is an artifact from a
+be set.
+It is an artifact from a
.Em new
implementation
of the
tty driver that allows generation of interrupt characters from
-the keyboard to tell jobs to stop. See
+the keyboard to tell jobs to stop.
+See
.Xr stty 1
for details
on setting options in the new tty driver.
This shell learns immediately whenever a process changes state.
It normally informs you whenever a job becomes blocked so that
no further progress is possible, but only just before it prints
-a prompt. This is done so that it does not otherwise disturb your work.
+a prompt.
+This is done so that it does not otherwise disturb your work.
If, however, you set the shell variable
.Va notify ,
the shell will notify you immediately of changes of status in background
There is also a shell command
.Ic notify
that marks a single process so that its status changes will be immediately
-reported. By default
+reported.
+By default
.Ic notify
marks the current process;
simply say
.Dq You have stopped jobs .
You may use the
.Ic jobs
-command to see what they are. If you do this or immediately try to
+command to see what they are.
+If you do this or immediately try to
exit again, the shell will not warn you a second time, and the suspended
jobs will be terminated.
.Ss File name completion
If a partial file name is followed by the end-of-file character
(usually control-D), then, instead of completing the name,
.Nm
-will list all file names matching the prefix. For example,
-the input
+will list all file names matching the prefix.
+For example, the input
.Pp
.Dl % vi D<control-D>
.Pp
.Va nobeep .
.Pp
Normally, all files in the particular directory are candidates
-for name completion. Files with certain suffixes can be excluded
+for name completion.
+Files with certain suffixes can be excluded
from consideration by setting the variable
.Va fignore
to the
-list of suffixes to be ignored. Thus, if
+list of suffixes to be ignored.
+Thus, if
.Va fignore
is set by
the command
and
.Qq xmpl.out .
However, if the only completion possible requires not ignoring these
-suffixes, then they are not ignored. In addition,
+suffixes, then they are not ignored.
+In addition,
.Va fignore
-does not affect the listing of file names by control-D. All files
-are listed regardless of their suffixes.
+does not affect the listing of file names by control-D.
+All files are listed regardless of their suffixes.
.Ss Substitutions
We now describe the various transformations the shell performs on the
input in the order in which they occur.
.Ql g& .
.It a
Apply the change as many times as possible on a single word, prefixing
-the above. It can be used together with
+the above.
+It can be used together with
.Ql g
to apply a substitution globally.
.It p
Unless preceded by a
.Ql g
the change is applied only to the first
-modifiable word. With substitutions, it is an error for no word to be
-applicable.
+modifiable word.
+With substitutions, it is an error for no word to be applicable.
.Pp
The left-hand side of substitutions are not regular expressions in the sense
of the editors, but instead strings.
.Ar name
from following characters that would otherwise be part of it.
Shell variables have names consisting of up to 20 letters and digits
-starting with a letter. The underscore character is considered a letter.
+starting with a letter.
+The underscore character is considered a letter.
If
.Ar name
is not a shell variable, but is set in the environment, then
.Ql \-
characters,
the shell searches for a user with that name and substitutes their
-home directory; thus
+home directory; thus
.Dq ~ken
might expand to
.Dq /usr/ken
modified to be the empty file
.Pa /dev/null ;
instead the standard input
-remains as the original standard input of the shell. If this is a terminal
+remains as the original standard input of the shell.
+If this is a terminal
and if the process attempts to read from the terminal, then the process
will block and the user will be notified (see
.Sx Jobs
.Ar pattern
(containing, e.g., *'s, ?'s, and instances of
.Dq [...] )
-against which the left-hand operand is matched. This reduces the
-need for use of the
+against which the left-hand operand is matched.
+This reduces the need for use of the
.Ar switch
statement in shell scripts when all that is really needed is pattern matching.
.Pp
Shows the amount of dynamic memory acquired, broken down into used and
free memory.
With an argument shows the number of free and used blocks in each size
-category. The categories start at size 8 and double at each step.
+category.
+The categories start at size 8 and double at each step.
This command's output may vary across system types, since
systems other than the
.Tn VAX
command(s) executed in the context of the current shell.
This is usually used to execute commands
generated as the result of command or variable substitution, since
-parsing occurs before these substitutions. See
+parsing occurs before these substitutions.
+See
.Xr tset 1
for an example of using
.Ic eval .
the current limit is printed; if no
.Ar resource
is given, then
-all limitations are given. If the
+all limitations are given.
+If the
.Fl h
-flag is given, the hard limits are used instead of the current
-limits. The hard limits impose a ceiling on the values of
-the current limits. Only the super-user may raise the hard limits,
+flag is given, the hard limits are used instead of the current limits.
+The hard limits impose a ceiling on the values of the current limits.
+Only the super-user may raise the hard limits,
but a user may lower or raise the current limits within the legal range.
.Pp
Resources controllable currently include
The
.Ar maximum-use
may be given as a (floating point or integer)
-number followed by a scale factor. For all limits other than
+number followed by a scale factor.
+For all limits other than
.Ar cputime
the default scale is
.Ql k
.It Ic notify % Ns Ar job ...
Causes the shell to notify the user asynchronously when the status of the
current or specified jobs change; normally notification is presented
-before a prompt. This is automatic if the shell variable
+before a prompt.
+This is automatic if the shell variable
.Va notify
is set.
.Pp
rotates the
.Ar n Ns \'th
argument of the directory
-stack around to be the top element and changes to it. The members
+stack around to be the top element and changes to it.
+The members
of the directory stack are numbered from the top starting at 0.
.Pp
.It Ic rehash
Causes the internal hash table of the contents of the directories in
the
.Va path
-variable to be recomputed. This is needed if new commands are added
-to directories in the
+variable to be recomputed.
+This is needed if new commands are added to directories in the
.Ic path
-while you are logged in. This should only be necessary if you add
+while you are logged in.
+This should only be necessary if you add
commands to one of your own directories, or if a systems programmer
changes the contents of a system directory.
.Pp
.Ar name
to be
.Ar value ,
-a single string. The second form sets
+a single string.
+The second form sets
.Ar name
to an empty string.
The most commonly used environment variables
the specified simple command is timed and a time summary
as described under the
.Ic time
-variable is printed. If necessary, an extra shell is created to print the time
+variable is printed.
+If necessary, an extra shell is created to print the time
statistic when the command completes.
.Pp
.It Ic umask
.It Ic umask Ar value
The file creation mask is displayed (first form) or set to the specified
-value (second form). The mask is given in octal. Common values for
+value (second form).
+The mask is given in octal.
+Common values for
the mask are 002 giving all access to the group and read and execute
access to others or 022 giving all access except write access for
users in the group or others.
is disabled.
.Pp
.It Ic unlimit
-.It Ic unlimit Ar resource
+.It Ic unlimit Ar resource
.It Ic unlimit Fl h
.It Ic unlimit Fl h Ar resource
Removes the limitation on
.Ar resource
is specified, then all
.Ar resource
-limitations are removed. If
+limitations are removed.
+If
.Fl h
-is given, the corresponding hard limits are removed. Only the
-super-user may do this.
+is given, the corresponding hard limits are removed.
+Only the superuser may do this.
.Pp
.It Ic unset Ar pattern
All variables whose names match the specified pattern are removed.
.Pp
.It Ic unsetenv Ar pattern
Removes all variables whose name match the specified pattern from the
-environment. See also the
+environment.
+See also the
.Ic setenv
command above and
.Xr printenv 1 .
Enable file name completion.
.It Ic histchars
Can be given a string value to change the characters used in history
-substitution. The first character of its value is used as the
+substitution.
+The first character of its value is used as the
history substitution character, replacing the default character
.Ql ! .
The second character of its value replaces the character
.Ar \&.cshrc ,
and each time the
.Ar path
-variable is reset. If new commands are added to these directories
+variable is reset.
+If new commands are added to these directories
while the shell is active, it may be necessary to do a
.Ic rehash
or the commands may not be found.
Command sequences of the form
.Dq a \&; b \&; c
are also not handled gracefully
-when stopping is attempted. If you suspend
+when stopping is attempted.
+If you suspend
.Ql b ,
the shell will immediately execute
.Ql c .
.Pp
Control over tty output after processes are started is primitive;
perhaps this will inspire someone to work on a good virtual
-terminal interface. In a virtual terminal interface much more
+terminal interface.
+In a virtual terminal interface much more
interesting things could be done with output control.
.Pp
Alias substitution is most often used to clumsily simulate shell procedures;
.Ic history
list.
Control structure should be parsed instead of being recognized as built-in
-commands. This would allow control commands to be placed anywhere,
+commands.
+This would allow control commands to be placed anywhere,
to be combined with
.Ql | ,
and to be used with
-.\" $OpenBSD: df.1,v 1.21 2000/03/05 00:28:51 aaron Exp $
+.\" $OpenBSD: df.1,v 1.22 2000/03/17 18:15:12 aaron Exp $
.\" $NetBSD: df.1,v 1.12 1995/12/05 02:42:45 jtc Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
The options are as follows:
.Bl -tag -width Ds
.It Fl h
-"Human-readable" output. Use unit suffixes: Byte, Kilobyte, Megabyte,
+"Human-readable" output.
+Use unit suffixes: Byte, Kilobyte, Megabyte,
Gigabyte, Terabyte, Petabyte, Exabyte in order to reduce the number of
digits to four or less.
.It Fl i
.It Fl l
Display statistics only about mounted file systems with the
.Dv MNT_LOCAL
-flag set. If a non-local file system is given as an argument, a
+flag set.
+If a non-local file system is given as an argument, a
warning is issued and no information is given on that file system.
.It Fl n
Print out the previously obtained statistics from the file systems.
.Dq no
to specify the filesystem types for which action should
.Em not
-be taken. If a file system is given on the command line that is not of
+be taken.
+If a file system is given on the command line that is not of
the specified type, a warning is issued and no information is given on
that file system.
.El
-.\" $OpenBSD: domainname.1,v 1.9 1999/10/05 19:59:12 ericj Exp $
+.\" $OpenBSD: domainname.1,v 1.10 2000/03/17 18:15:13 aaron Exp $
.\" $NetBSD: domainname.1,v 1.7 1995/07/25 19:36:57 jtc Exp $
.\"
.\" Copyright (c) 1983, 1988, 1990, 1993
.Sh DESCRIPTION
The
.Nm
-utility prints the YP domain name of the current host. The super-user can
-set the domain name by supplying a
+utility prints the YP domain name of the current host.
+The superuser can set the domain name by supplying a
.Pa /etc/defaultdomain
-file. This is used at system boot time by
+file.
+This is used at system boot time by
.Xr /etc/rc 8
to initialize the domainname.
.Sh SEE ALSO
-.\" $OpenBSD: ed.1,v 1.20 1999/07/04 18:59:37 aaron Exp $
+.\" $OpenBSD: ed.1,v 1.21 2000/03/17 18:15:13 aaron Exp $
.\"
.Dd May 2, 1993
.Dt ED 1
.Em c
(change), is given,
.Nm
-enters input mode. This is the primary means
-of adding text to a file.
+enters input mode.
+This is the primary means of adding text to a file.
In this mode, no commands are available;
instead, the standard input is written
-directly to the editor buffer. Lines consist of text up to and
-including a
+directly to the editor buffer.
+Lines consist of text up to and including a
.Em newline
character.
Input mode is terminated by
.Em m
command moves lines, and so on.
It is possible to modify only a portion of a line by means of replacement,
-as in the example above. However, even here, the
+as in the example above.
+However, even here, the
.Em s
command is applied to whole lines at a time.
.Pp
.Ed
.Pp
The address(es) indicate the line or range of lines to be affected by the
-command. If fewer addresses are given than the command accepts, then
+command.
+If fewer addresses are given than the command accepts, then
default addresses are supplied.
.Pp
.Ss OPTIONS
.Bl -tag -width Ds
.It Fl s
-Suppresses diagnostics. This should be used if
+Suppresses diagnostics.
+This should be used if
.Nm
standard input is from a script.
.It Fl x
.Em x
command).
.It Fl p Ar string
-Specifies a command prompt. This may be toggled on and off with the
+Specifies a command prompt.
+This may be toggled on and off with the
.Em P
command.
.It Ar file
-Specifies the name of a file to read. If
+Specifies the name of a file to read.
+If
.Ar file
is prefixed with a
bang
.Pq Ql \&! ,
-then it is interpreted as a shell command. In this case,
-what is read is
-the standard output of
+then it is interpreted as a shell command.
+In this case, what is read is the standard output of
.Ar file
executed via
.Xr sh 1 .
which is
typically supplied to commands as the default address when none is specified.
When a file is first read, the current address is set to the last line
-of the file. In general, the current address is set to the last line
+of the file.
+In general, the current address is set to the last line
affected by a command.
.Pp
A line address is
constructed from one of the bases in the list below, optionally followed
-by a numeric offset. The offset may include any combination
-of digits, operators (i.e.,
+by a numeric offset.
+The offset may include any combination of digits, operators (i.e.,
.Em +
,
.Em -
and is legal wherever it makes sense.
.Pp
An address range is two addresses separated either by a comma or
-semi-colon. The value of the first address in a range cannot exceed the
-value of the second. If only one address is given in a range, then
-the second address is set to the given address. If an
+semi-colon.
+The value of the first address in a range cannot exceed the
+value of the second.
+If only one address is given in a range, then
+the second address is set to the given address.
+If an
.Em n Ns No -tuple
of addresses is given where
.Em n > 2,
If only one address is expected, then the last address is used.
.Pp
Each address in a comma-delimited range is interpreted relative to the
-current address. In a semi-colon-delimited range, the first address is
+current address.
+In a semi-colon-delimited range, the first address is
used to set the current address, and the second address is interpreted
relative to the first.
.Pp
.Em n
is a non-negative number.
.It Em \&, No or Em %
-The first through last lines in the buffer. This is equivalent to
-the address range
+The first through last lines in the buffer.
+This is equivalent to the address range
.Em 1,$.
.It Em \&;
The
-current through last lines in the buffer. This is equivalent to
-the address range
+current through last lines in the buffer.
+This is equivalent to the address range
.Em .,$.
.It Em / Ns No re Ns Em /
The
.Pp
In addition to a specifying string literals, regular expressions can
represent
-classes of strings. Strings thus represented are said to be matched
+classes of strings.
+Strings thus represented are said to be matched
by the corresponding regular expression.
If it is possible for a regular expression
to match several strings in a line, then the left-most longest match is
their left delimiter.
.It Em *
Matches the single character regular expression or subexpression
-immediately preceding it zero or more times. If
+immediately preceding it zero or more times.
+If
.Em *
is the first
character of a regular expression or subexpression, then it matches
-itself. The
+itself.
+The
.Em *
operator sometimes yields unexpected results.
For example, the regular expression
and returning the editor to command mode.
.Pp
.Nm
-recognizes the following commands. The commands are shown together with
+recognizes the following commands.
+The commands are shown together with
the default address or address range supplied if none is
specified (in parenthesis), and other possible arguments on the right.
.Bl -tag -width Dxxs
Text is entered in input mode.
The current address is set to last line entered.
.It (.,.) Ns Em c
-Changes lines in the buffer. The addressed lines are deleted
+Changes lines in the buffer.
+The addressed lines are deleted
from the buffer, and text is appended in their place.
Text is entered in input mode.
The current address is set to last line entered.
.It (.,.) Ns Em d
Deletes the addressed lines from the buffer.
If there is a line after the deleted range, then the current address is set
-to this line. Otherwise the current address is set to the line
+to this line.
+Otherwise the current address is set to the line
before the deleted range.
.It Em e No file
Edits
.Em command-list
is the same as that of the
.Em g
-command. A newline alone acts as a null command list.
+command.
+A newline alone acts as a null command list.
A single
.Em &
repeats the last non-null command list.
Text is entered in input mode.
The current address is set to the last line entered.
.It (.,.+1) Ns Em j
-Joins the addressed lines. The addressed lines are
+Joins the addressed lines.
+The addressed lines are
deleted from the buffer and replaced by a single
line containing their joined text.
The current address is set to the resultant line.
The current address is set to the last line
printed.
.It (.,.) Ns Em m Ns No (.)
-Moves lines in the buffer. The addressed lines are moved to after the
+Moves lines in the buffer.
+The addressed lines are moved to after the
right-hand destination address, which may be the address
.Em 0
(zero).
last line moved.
.It (.,.) Ns Em n
Prints the addressed lines along with
-their line numbers. The current address is set to the last line
-printed.
+their line numbers.
+The current address is set to the last line printed.
.It (.,.) Ns Em p
-Prints the addressed lines. The current address is set to the last line
-printed.
+Prints the addressed lines.
+The current address is set to the last line printed.
.It Em P
Toggles the command prompt on and off.
Unless a prompt was specified by with command-line option
.It ($) Ns Em r No file
Reads
.Em file
-to after the addressed line. If
+to after the addressed line.
+If
.Em file
is not specified, then the default
-filename is used. If there was no default filename prior to the command,
+filename is used.
+If there was no default filename prior to the command,
then the default filename is set to
.Em file Ns No .
Otherwise, the default filename is unchanged.
is lost without warning.
If there is no default filename, then the default filename is set to
.Em file Ns No ,
-otherwise it is unchanged. If no filename is specified, then the default
+otherwise it is unchanged.
+If no filename is specified, then the default
filename is used.
The current address is unchanged.
.It (1,$) Ns Em wq No file
The current address is unchanged.
.It Em x
Prompts for an encryption key which is used in subsequent reads and
-writes. If a newline alone is entered as the key, then encryption is
-turned off. Otherwise, echoing is disabled while a key is read.
+writes.
+If a newline alone is entered as the key, then encryption is
+turned off.
+Otherwise, echoing is disabled while a key is read.
Encryption/decryption is done using the
.Xr bdes 1
algorithm.
.It (.+1) Ns Em z Ns No n
Scrolls
.Em n
-lines at a time starting at addressed line. If
+lines at a time starting at addressed line.
+If
.Em n
is not specified, then the current window size is used.
The current address is set to the last line printed.
If a text (non-binary) file is not terminated by a newline character,
then
.Nm
-appends one on reading/writing it. In the case of a binary file,
+appends one on reading/writing it.
+In the case of a binary file,
.Nm
does not append a newline on reading/writing.
.Sh DIAGNOSTICS
-.\" $OpenBSD: expr.1,v 1.8 1999/09/23 10:43:07 aaron Exp $
+.\" $OpenBSD: expr.1,v 1.9 2000/03/17 18:15:13 aaron Exp $
.\" $NetBSD: expr.1,v 1.9 1995/04/28 23:27:13 jtc Exp $
.\"
.\" Written by J.T. Conklin <jtc@netbsd.org>.
.Ar expr1
against
.Ar expr2 ,
-which must be a regular expression. The regular expression is anchored
+which must be a regular expression.
+The regular expression is anchored
to the beginning of the string with an implicit
.Ql ^ .
.Pp
-.\" $OpenBSD: hostname.1,v 1.9 1999/10/05 19:58:31 ericj Exp $
+.\" $OpenBSD: hostname.1,v 1.10 2000/03/17 18:15:13 aaron Exp $
.\" $NetBSD: hostname.1,v 1.11 1995/09/07 06:28:39 jtc Exp $
.\"
.\" Copyright (c) 1983, 1988, 1990, 1993
.Sh DESCRIPTION
The
.Nm
-utility prints the name of the current host. The super-user can
-set the host name by supplying a
+utility prints the name of the current host.
+The superuser can set the host name by supplying a
.Pa /etc/myname
-file. This is used at system boot time by
+file.
+This is used at system boot time by
.Xr /etc/rc 8
to initialize the hostname.
.Pp
-.\" $OpenBSD: kill.1,v 1.11 1999/09/23 10:50:45 aaron Exp $
+.\" $OpenBSD: kill.1,v 1.12 2000/03/17 18:15:14 aaron Exp $
.\" $NetBSD: kill.1,v 1.8 1995/09/07 06:30:26 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.Nm
arguments.
See
-.Xr csh 1
+.Xr csh 1
for details.
.Sh SEE ALSO
.Xr csh 1 ,
A replacement for the command
.Dq Li kill 0
for
-.Xr csh 1
+.Xr csh 1
users should be provided.
-.\" $OpenBSD: ksh.1,v 1.30 2000/03/14 20:25:46 aaron Exp $
+.\" $OpenBSD: ksh.1,v 1.31 2000/03/17 18:15:16 aaron Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.Sh DESCRIPTION
.Nm ksh
is a command interpreter intended for both interactive and shell
-script use. Its command language is a superset of the
+script use.
+Its command language is a superset of the
.Xr sh 1
shell language.
.Ss Shell startup
nor the
.Fl s
option is specified, the first non-option argument specifies the name
-of a file the shell reads commands from. If there are no non-option
-arguments, the shell reads commands from the standard input. The name of
+of a file the shell reads commands from.
+If there are no non-option
+arguments, the shell reads commands from the standard input.
+The name of
the shell (i.e., the contents of $0) is determined as follows: if the
.Fl c
option is used and there is a non-option argument, it is used as the name;
if the
.Fl i
option is used or if both standard input and standard error are attached
-to a tty. An interactive shell has job control enabled (if available),
-ignores the
+to a tty.
+An interactive shell has job control enabled (if available), ignores the
.Dv SIGINT ,
.Dv SIGQUIT ,
and
.Pa $HOME/.profile
nor the
.Ev ENV
-parameter (see below). Instead, the file
+parameter (see below).
+Instead, the file
.Pa /etc/suid_profile
-is processed. Clearing the privileged option causes the shell to set
+is processed.
+Clearing the privileged option causes the shell to set
its effective user ID (group ID) to its real user ID (group ID).
.Pp
If the basename of the name the shell is called with (i.e., argv[0])
command, arithmetic, and tilde
.Pq Sq \&~
substitution and the resulting file
-(if any) is read and executed. If the
+(if any) is read and executed.
+If the
.Ev ENV
parameter is not set (and not
.Dv NULL )
.Pp
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,
+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
command is executed.
.Ss Command syntax
.Ql \&)
.Pc .
Aside from delimiting words, spaces and tabs are ignored, while newlines
-usually delimit commands. The meta-characters are used in building the
-following tokens:
+usually delimit commands.
+The meta-characters are used in building the following tokens:
.Ql < ,
.Ql <& ,
.Ql > ,
.Pq Sq \&"
or single
.Pq Sq \&'
-quotes. Note that the following characters are also treated specially by the
+quotes.
+Note that the following characters are also treated specially by the
shell and must be quoted if they are to represent themselves:
.Ql \e ,
.Ql \&" ,
.Sx Input/output redirections
below),
and command words; the only restriction is that parameter assignments come
-before any command words. The command words, if any, define the command
-that is to be executed and its arguments. The command may be a shell built-in
+before any command words.
+The command words, if any, define the command
+that is to be executed and its arguments.
+The command may be a shell built-in
command, a function or an external command (i.e., a separate executable file
that is located using the
.Ev PATH
be executed, the exit status is 126); the exit status of other command
constructs (built-in commands, functions, compound-commands, pipelines, lists,
etc.) are all well-defined and are described where the construct is
-described. The exit status of a command consisting only of parameter
+described.
+The exit status of a command consisting only of parameter
assignments is that of the last command substitution performed during the
parameter assignment or 0 is there were no command substitutions.
.Pp
token to form pipelines, in which the standard output of each command but the
last is piped (see
.Xr pipe 2 )
-to the standard input of the following command. The exit status of a pipeline
-is that of its last command. A pipeline may be prefixed by the
+to the standard input of the following command.
+The exit status of a pipeline is that of its last command.
+A pipeline may be prefixed by the
.Ql !
reversed word which causes the exit status of the pipeline to be logically
complemented: if the original status was 0 the complemented status will be 1;
.Ql |&
and
.Ql \&; ,
-which also have equal precedence. The
+which also have equal precedence.
+The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
the shell starts the command but does not wait for it to complete (the shell
does keep track of the status of asynchronous commands, see
.Sx Job control
-below). When an asynchronous command is started when job control is disabled
+below).
+When an asynchronous command is started when job control is disabled
(i.e., in most scripts), the command is started with signals
.Dv SIGINT
and
operator starts a co-process which is a special kind of asynchronous process
(see
.Sx Co-processes
-below). Note that a command must follow the
+below).
+Note that a command must follow the
.Ql &&
and
.Ql ||
The exit status of a list is that of the last command executed, with the
exception of asynchronous lists, for which the exit status is 0.
.Pp
-Compound commands are created using the following reserved words. These words
+Compound commands are created using the following reserved words.
+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):
.Sy Note:
Some shells (but not this one) execute control structure commands in a
subshell when one or more of their file descriptors are redirected, so any
-environment changes inside them may fail. To be portable, the
+environment changes inside them may fail.
+To be portable, the
.Ic exec
statement should be used instead to redirect file descriptors before the
control structure.
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
-a (syntactically correct) reserved word. For example,
+a (syntactically correct) reserved word.
+For example,
.Pp
.Bl -inset -indent -compact
.It Ic { echo foo; echo bar; }
.It Ic \&( Ar list Ic \&)
Execute
.Ar list
-in a subshell. There is no implicit way to pass environment changes from a
+in a subshell.
+There is no implicit way to pass environment changes from a
subshell back to its parent.
.It Ic \&{ Ar list Ic \&}
Compound construct;
.Ar list
-is executed, but not in a subshell. Note that
+is executed, but not in a subshell.
+Note that
.Ic \&{
and
.Ic \&}
.Ar pattern Ns s ;
the
.Ar list
-associated with the first successfully matched pattern is executed. Patterns
-used in
+associated with the first successfully matched pattern is executed.
+Patterns used in
.Ic case
statements are the same as those used for file name patterns except that the
restrictions regarding
.Ql \&.
and
.Ql /
-are dropped. Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted. Both the word and the
-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
+are dropped.
+Note that any unquoted space before and after a pattern is
+stripped; any space with a pattern must be quoted.
+Both the word and the
+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
and
.Ic esac
.Ar name
is set to the word and
.Ar list
-is executed. If
+is executed.
+If
.Ic in
is not used to specify a word list, the positional parameters ($1, $2, etc.)
-are used instead. For historical reasons, open and close braces may be used
-instead of
+are used instead.
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Ar list
following the
.Ic elif ,
-if any, is executed with similar consequences. If all the lists following
-the
+if any, is executed with similar consequences.
+If all the lists following the
.Ic if
and
.Ic elif Ns s
.Ar list
following the
.Ic else
-is executed. The exit status of an
+is executed.
+The exit status of an
.Ic if
statement is that of non-conditional
.Ar list
The
.Ic select
statement provides an automatic method of presenting the user with a menu and
-selecting from it. An enumerated list of the specified
+selecting from it.
+An enumerated list of the specified
.Ar word Ns s
is printed on standard error, followed by a prompt
.Po
.Ev REPLY
is
.Dv NULL ,
-the prompt is printed and so on. This process continues until an end-of-file
+the prompt is printed and so on.
+This process continues until an end-of-file
is read, an interrupt is received, or a
.Ic break
-statement is executed inside the loop. If
+statement is executed inside the loop.
+If
.Ic in Ar word Ar ...
-is omitted, the positional parameters are used (i.e., $1, $2, etc.). For
-historical reasons, open and close braces may be used instead of
+is omitted, the positional parameters are used (i.e., $1, $2, etc.).
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Xc
A
.Ic while
-is a pre-checked loop. Its body is executed as often as the exit status of
-the first
+is a pre-checked loop.
+Its body is executed as often as the exit status of the first
.Ar list
-is zero. The exit status of a
+is zero.
+The exit status of a
.Ic while
statement is the last exit status of the
.Ar list
.Ar name
(see
.Sx Functions
-below). Note that redirections specified after a function definition are
+below).
+Note that redirections specified after a function definition are
performed whenever the function is executed, not when the function definition
is executed.
.It Ar name Ic () Ar command
.Ql &&
and
.Ql ||
-operators. This means that in the statement
+operators.
+This means that in the statement
.Pp
.Ic \&[[ -r foo && $(< foo) = b*r ]]
.Pp
.El
.Ss Quoting
Quoting is used to prevent the shell from treating characters or words
-specially. There are three methods of quoting. First,
+specially.
+There are three methods of quoting.
+First,
.Ql \e
quotes the following character, unless it is at the end of a line, in which
case both the
.Ql \e
-and the newline are stripped. Second, a single quote
+and the newline are stripped.
+Second, a single quote
.Pq Sq '
-quotes everything up to the next single quote (this may span lines). Third,
-a double quote
+quotes everything up to the next single quote (this may span lines).
+Third, a double quote
.Pq Sq \&"
quotes all characters, except
.Ql $ ,
.Ql `
inside double quotes have their usual meaning (i.e., parameter, command or
arithmetic substitution) except no field splitting is carried out on the
-results of double-quoted substitutions. If a
+results of double-quoted substitutions.
+If a
.Ql \e
inside a double-quoted string is followed by
.Ql \e ,
.Ss Aliases
There are two types of aliases: normal command aliases and tracked aliases.
Command aliases are normally used as a short hand for a long or often used
-command. The shell expands command aliases (i.e., substitutes the alias name
-for its value) when it reads the first word of a command. An expanded alias
-is re-processed to check for more aliases. If a command alias ends in a
-space or tab, the following word is also checked for alias expansion. The
-alias expansion process stops when a word that is not an alias is found, when
-a quoted word is found or when an alias word that is currently being expanded
-is found.
+command.
+The shell expands command aliases (i.e., substitutes the alias name
+for its value) when it reads the first word of a command.
+An expanded alias is re-processed to check for more aliases.
+If a command alias ends in a
+space or tab, the following word is also checked for alias expansion.
+The alias expansion process stops when a word that is not an alias is found,
+when a quoted word is found or when an alias word that is currently being
+expanded is found.
.Pp
The following command aliases are defined automatically by the shell:
.Pp
.El
.Pp
Tracked aliases allow the shell to remember where it found a particular
-command. 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
+command.
+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. Tracked aliases
-can be listed and created using
+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
.Ev PATH
-parameter clears the saved paths for all tracked aliases. If the
+parameter clears the saved paths for all tracked aliases.
+If the
.Ic trackall
option is set (i.e.,
.Ic set Fl o Ic trackall
or
.Ic set Fl h ) ,
-the shell tracks all commands. This option is set automatically for
-non-interactive shells. For interactive shells, only the following commands are
+the shell tracks all commands.
+This option is set automatically for
+non-interactive shells.
+For interactive shells, only the following commands are
automatically tracked:
.Ic cat , cc , chmod , cp ,
.Ic date , ed , emacs , grep ,
.Ic who .
.Ss Substitution
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. Parameter substitutions,
+substitutions on the words of the command.
+There are three kinds of
+substitution: parameter, command, and arithmetic.
+Parameter substitutions,
which are described in detail in the next section, take the form
.Ic $ Ns Ar name
or
substitution are generally subject to word or field splitting according to
the current value of the
.Ev IFS
-parameter. The
+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
whitespace characters, in combination with zero or no
.Pf non- Ev IFS
whitespace
-characters, delimit a field. As a special case, leading and trailing
+characters, delimit a field.
+As a special case, leading and trailing
.Ev IFS
whitespace is stripped (i.e., no leading or trailing empty field is created by
it); leading or trailing
brace expansion and file name expansion (see the relevant sections below).
.Pp
A command substitution is replaced by the output generated by the specified
-command, which is run in a subshell. For
+command, which is run in a subshell.
+For
.Ic $( Ns Ar command Ns Ic \&)
substitutions, normal quoting rules are used when
.Ar command
.Ql \e
is stripped (a
.Ql \e
-followed by any other character is unchanged). As a special case in command
-substitutions, a command of the form
+followed by any other character is unchanged).
+As a special case in command substitutions, a command of the form
.Ic \&< Ar file
is interpreted to mean substitute the contents of
.Ar file
.Sy Note:
.Ic $( Ns Ar command Ns Ic \&)
expressions are currently parsed by finding the matching parenthesis,
-regardless of quoting. This should be fixed soon.
+regardless of quoting.
+This should be fixed soon.
.Pp
Arithmetic substitutions are replaced by the value of the specified expression.
For example, the command
.Ic echo $((2+3*4))
-prints 14. See
+prints 14.
+See
.Sx Arithmetic expressions
for a description of an expression.
.Ss Parameters
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
+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
.Po
.Pc
is set, in which case an error occurs.
.Pp
-Parameters can be assigned valued in a number of ways. First, the shell
-implicitly sets some parameters like
+Parameters can be assigned valued in a number of ways.
+First, the shell implicitly sets some parameters like
.Ic # , PWD ,
etc.; this is the only way the special single character parameters are set.
-Second, parameters are imported from the shell's environment at startup. Third,
-parameters can be assigned values on the command line, for example,
+Second, parameters are imported from the shell's environment at startup.
+Third, parameters can be assigned values on the command line, for example,
.Ic FOO=bar
sets the parameter
.Ev FOO
multiple parameter assignments can be given on a single command line and they
can be followed by a simple-command, in which case the assignments are in
effect only for the duration of the command (such assignments are also
-exported, see below for implications of this). Note that both the parameter
-name and the
+exported, see below for implications of this).
+Note that both the parameter name and the
.Ql =
-must be unquoted for the shell to recognize a parameter assignment. The fourth
-way of setting a parameter is with the
+must be unquoted for the shell to recognize a parameter assignment.
+The fourth way of setting a parameter is with the
.Ic export ,
.Ic readonly
and
.Ic typeset
commands; see their descriptions in the
.Sx Command execution
-section. Fifth,
+section.
+Fifth,
.Ic for
and
.Ic select
.Ic read
and
.Ic set Fl A
-commands. Lastly, parameters can be assigned values using assignment operators
+commands.
+Lastly, parameters can be assigned values using assignment operators
inside arithmetic expressions (see
.Sx Arithmetic expressions
below) or using the
.Xr environ 5 )
of commands run by the shell as
.Ar name Ns No = Ns Ar value
-pairs. The order in which parameters appear in the environment of a command is
-unspecified. When the shell starts up, it extracts parameters and their values
+pairs.
+The order in which parameters appear in the environment of a command is
+unspecified.
+When the shell starts up, it extracts parameters and their values
from its environment and automatically sets the export attribute for those
parameters.
.Pp
is printed on standard error (preceded by
.Ar name Ns No \&: )
and an error occurs (normally causing termination of a shell script, function
-or .-script). If word is omitted the string
+or .-script).
+If word is omitted the string
.Dq parameter null or not set
is used instead.
.El
.Ar pattern
matches the beginning of the value of parameter
.Ar name ,
-the matched text is deleted from the result of substitution. A single
+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.
set directly using assignments:
.Bl -tag -width "1 ... 9"
.It Ev \&!
-Process ID of the last background process started. If no background processes
-have been started, the parameter is not set.
+Process ID of the last background process started.
+If no background processes have been started, the parameter is not set.
.It Ev \&#
The number of positional parameters (i.e., $1, $2, etc.).
.It Ev \&$
.Ic set
command below for list of options).
.It Ev \&?
-The exit status of the last non-asynchronous command executed. If the last
-command was killed by a signal,
+The exit status of the last non-asynchronous command executed.
+If the last command was killed by a signal,
.Ic \&$\&?
is set to 128 plus the signal number.
.It Ev 0
.Ar command-name
was supplied, or the
.Ar file
-argument, if it was supplied. If the
+argument, if it was supplied.
+If the
.Ic posix
option is not set,
.Ic \&$0
is the name of the current function or script.
.It Ev 1 ... Ev 9
The first nine positional parameters that were supplied to the shell, function
-or .-script. Further positional parameters may be accessed using
+or .-script.
+Further positional parameters may be accessed using
.Ic ${ Ns Ar number Ns Ic \&} .
.It Ev \&*
-All positional parameters (except parameter 0), i.e., $1, $2, $3... If used
+All positional parameters (except parameter 0), i.e., $1, $2, $3...
+If used
outside of double quotes, parameters are separate words (which are subjected
to word splitting); if used within double quotes, parameters are separated
by the first character of the
Same as
.Ic \&$\&* ,
unless it is used inside double quotes, in which case a separate word is
-generated for each positional parameter. If there are no positional parameters,
-no word is generated.
+generated for each positional parameter.
+If there are no positional parameters, no word is generated.
.Ic \&$\&@
can be used to access arguments, verbatim, without losing
.Dv NULL
.Bl -tag -width "EXECSHELL"
.It Ev \&_ No (underscore)
When an external command is executed by the shell, this parameter is set in the
-environment of the new process to the path of the executed command. In
-interactive use, this parameter is also set in the parent shell to the last
-word of the previous command. When
+environment of the new process to the path of the executed command.
+In interactive use, this parameter is also set in the parent shell to the last
+word of the previous command.
+When
.Ev MAILPATH
messages are evaluated, this parameter contains the name of the file that
changed (see
.It Ev CDPATH
Search path for the
.Ic cd
-built-in command. Works the same way as
+built-in command.
+Works the same way as
.Ev PATH
for those directories not beginning with
.Ql /
in
.Ic cd
-commands. Note that if
+commands.
+Note that if
.Ev CDPATH
is set and does not contain
.Dq \&.
-or contains an empty path, the current directory is not searched. Also, the
+or contains an empty path, the current directory is not searched.
+Also, the
.Ic cd
built-in command will display the resulting directory when a match is found
in any search path other than the empty path.
.It Ev COLUMNS
-Set to the number of columns on the terminal or window. Currently set to the
+Set to the number of columns on the terminal or window.
+Currently set to the
.Dq cols
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
+if that value is non-zero.
+This parameter is used by the interactive line editing modes, and by
.Ic select ,
.Ic set Fl o ,
and
If the
.Ev VISUAL
parameter is not set, this parameter controls the command-line editing mode for
-interactive shells. See
+interactive shells.
+See
.Ev VISUAL
parameter below for how this works.
.It Ev ENV
If this parameter is found to be set after any profile files are executed, the
-expanded value is used as a shell startup file. It typically contains function
-and alias definitions.
+expanded value is used as a shell startup file.
+It typically contains function and alias definitions.
.It Ev ERRNO
Integer value of the shell's
.Va errno
-variable. It indicates the reason the last system call failed. Not yet
-implemented.
+variable.
+It indicates the reason the last system call failed.
+Not yet implemented.
.It Ev EXECSHELL
If set, this parameter is assumed to contain the shell that is to be used to
execute commands that
Like
.Ev PATH ,
but used when an undefined function is executed to locate the file defining the
-function. It is also searched when a command can't be found using
+function.
+It is also searched when a command can't be found using
.Ev PATH .
See
.Sx Functions
below for more information.
.It Ev HISTFILE
-The name of the file used to store command history. When assigned to, history
-is loaded from the specified file. Also, several invocations of the shell
+The name of the file used to store command history.
+When assigned to, history is loaded from the specified file.
+Also, several invocations of the shell
running on the same machine will share history if their
.Ev HISTFILE
parameters all point to the same file.
.Sy Note:
If
.Ev HISTFILE
-isn't set, no history file is used. This is different from the original Korn
-shell, which uses
+isn't set, no history file is used.
+This is different from the original Korn shell, which uses
.Pa $HOME/.sh_history ;
in future,
.Nm pdksh
may also use a default history file.
.It Ev HISTSIZE
-The number of commands normally stored for history. The default is 128.
+The number of commands normally stored for history.
+The default is 128.
.It Ev HOME
The default directory for the
.Ic cd
Internal field separator, used during substitution and by the
.Ic read
command, to split values into distinct arguments; normally set to space, tab
-and newline. See
+and newline.
+See
.Sx Substitution
above for details.
.Pp
The line number of the function or shell script that is currently being
executed.
.It Ev LINES
-Set to the number of lines on the terminal or window. Not yet implemented.
+Set to the number of lines on the terminal or window.
+Not yet implemented.
.It Ev MAIL
If set, the user will be informed of the arrival of mail in the named file.
This parameter is ignored if the
.Ev MAIL
or
.Ev MAILPATH .
-If set to 0, the shell checks before each prompt. The default is 600 (10
-minutes).
+If set to 0, the shell checks before each prompt.
+The default is 600 (10 minutes).
.It Ev MAILPATH
-A list of files to be checked for mail. The list is colon separated, and each
-file may be followed by a
+A list of files to be checked for mail.
+The list is colon separated, and each file may be followed by a
.Ql ?
-and a message to be printed if new mail has arrived. Command, parameter and
+and a message to be printed if new mail has arrived.
+Command, parameter and
arithmetic substitution is performed on the message, and, during substitution,
the parameter
.Ev $_
-contains the name of the file. The default message is
+contains the name of the file.
+The default message is
.Dq you have mail in $_ .
.It Ev OLDPWD
-The previous working directory. Unset if
+The previous working directory.
+Unset if
.Ic cd
has not successfully changed directories since the shell started, or if the
shell doesn't know where it is.
to process arguments from the beginning the next time it is invoked.
.It Ev PATH
A colon separated list of directories that are searched when looking for
-commands and .'d files. An empty string resulting from a leading or trailing
+commands and .'d files.
+An empty string resulting from a leading or trailing
colon, or two adjacent colons, is treated as a
.Dq \&. ,
the current directory.
.It Ev POSIXLY_CORRECT
If set, this parameter causes the
.Ic posix
-option to be enabled. See
+option to be enabled.
+See
.Sx POSIX mode
below.
.It Ev PPID
The process ID of the shell's parent (read-only).
.It Ev PS1
-The primary prompt for interactive shells. Parameter, command, and arithmetic
+The primary prompt for interactive shells.
+Parameter, command, and arithmetic
substitutions are performed, and
.Ql !
is replaced with the current command number (see
.Ic fc
-command below). A literal
+command below).
+A literal
.Ql !
can be put in the prompt by placing
.Ql !!
.Ev PS1 .
Note that since the command-line editors try to figure out how long the prompt
is (so they know how far it is to the edge of the screen), escape codes in
-the prompt tend to mess things up. You can tell the shell not to count certain
+the prompt tend to mess things up.
+You can tell the shell not to count certain
sequences (such as escape codes) by prefixing your prompt with a non-printing
character (such as control-A) followed by a carriage return and then delimiting
-the escape codes with this non-printing character. If you don't have any
-non-printing characters, you're out of luck. By the way, don't blame me for
+the escape codes with this non-printing character.
+If you don't have any non-printing characters, you're out of luck.
+By the way, don't blame me for
this hack; it's in the original
.Xr ksh .
Default is
.It Ev PS3
Prompt used by
.Ic select
-statement when reading a menu selection. Default is
+statement when reading a menu selection.
+Default is
.Dq \&#\&?\ \& .
.It Ev PS4
Used to prefix commands that are printed during execution tracing (see
.Ic set Fl x
-command below). Parameter, command, and arithmetic substitutions are performed
-before it is printed. Default is
+command below).
+Parameter, command, and arithmetic substitutions are performed
+before it is printed.
+Default is
.Dq \&+\ \& .
.It Ev PWD
-The current working directory. May be unset or
+The current working directory.
+May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev RANDOM
-A simple random number generator. Every time
+A simple random number generator.
+Every time
.Ev RANDOM
-is referenced, it is assigned the next number in a random number series. The
-point in the series can be set by assigning a number to
+is referenced, it is assigned the next number in a random number series.
+The point in the series can be set by assigning a number to
.Ev RANDOM
(see
.Xr rand 3 ) .
.It Ev REPLY
Default parameter for the
.Ic read
-command if no names are given. Also used in
+command if no names are given.
+Also used in
.Ic select
loops to store the value that is read from standard input.
.It Ev SECONDS
.Pq Ev PS1 .
If the time is exceeded, the shell exits.
.It Ev TMPDIR
-The directory shell temporary files are created in. If this parameter is not
+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
files are created in
.Pa /tmp .
.It Ev VISUAL
If set, this parameter controls the command-line editing mode for interactive
-shells. If the last component of the path specified in this parameter contains
+shells.
+If the last component of the path specified in this parameter contains
the string
.Dq vi ,
.Dq emacs
.Ql ~ .
The characters following the tilde, up to the first
.Ql / ,
-if any, are assumed to be a login name. If the login name is empty,
+if any, are assumed to be a login name.
+If the login name is empty,
.Ql +
or
.Ql - ,
.Ev PWD ,
or
.Ev OLDPWD
-parameter is substituted, respectively. Otherwise, the password file is
+parameter is substituted, respectively.
+Otherwise, the password file is
searched for the login name, and the tilde expression is substituted with the
-user's home directory. If the login name is not found in the password file or
+user's home directory.
+If the login name is not found in the password file or
if any quoting or parameter substitution occurs in the login name, no
substitution is performed.
.Pp
and
.Dq ade ) .
As noted in the example, brace expressions can be nested and the resulting
-words are not sorted. Brace expressions must contain an unquoted comma
+words are not sorted.
+Brace expressions must contain an unquoted comma
.Pq Sq \&,
for expansion to occur (i.e.,
.Ic {}
and
.Ic {foo}
-are not expanded). Brace expansion is carried out after parameter substitution
+are not expanded).
+Brace expansion is carried out after parameter substitution
and before file name generation.
.Ss File name patterns
A file name pattern is a word containing one or more unquoted
.Ql *
characters or
.Dq [..]
-sequences. Once brace expansion has been performed, the shell replaces file
+sequences.
+Once brace expansion has been performed, the shell replaces file
name patterns with the sorted named of all the files that match the pattern
-(if no files match, the word is left unchanged). The pattern elements have the
-following meaning:
+(if no files match, the word is left unchanged).
+The pattern elements have the following meaning:
.Bl -tag -width Ds
.It Ic \&?
Matches any single character.
.It Ic \&*
Matches any sequence of characters.
.It Ic \&[ Ns No .. Ns Ic \&]
-Matches any of the characters inside the brackets. Ranges of characters can be
+Matches any of the characters inside the brackets.
+Ranges of characters can be
specified by separating two characters by a
.Ql -
(e.g.,
.Dq [a0-9]
matches the letter
.Dq a
-or any digit). In order to represent itself, a
+or any digit).
+In order to represent itself, a
.Ql -
must either be quoted or the first or last character in the character list.
Similarly, a
.Ql \&]
must be quoted or the first character in the list if it is to represent itself
-instead of the end of the list. Also, a
+instead of the end of the list.
+Also, a
.Ql !
appearing at the start of the list has special meaning (see below), so to
represent itself it must be quoted or appear later in the list.
.Xc
.Sm on
Matches any string of characters that matches zero or more occurrences of the
-specified patterns. Example: The pattern
+specified patterns.
+Example: The pattern
.Ic \&*(foo\&|bar)
matches the strings
.Dq ,
.Xc
.Sm on
Matches any string of characters that matches one or more occurrences of the
-specified patterns. Example: The pattern
+specified patterns.
+Example: The pattern
.Ic \&+(foo\&|bar)
matches the strings
.Dq foo ,
.Xc
.Sm on
Matches the empty string or a string that matches one of the specified
-patterns. Example: The pattern
+patterns.
+Example: The pattern
.Ic \&?(foo\&|bar)
only matches the strings
.Dq ,
.Ic \&| Ar pattern Ic \&)
.Xc
.Sm on
-Matches a string that matches one of the specified patterns. Example: The
-pattern
+Matches a string that matches one of the specified patterns.
+Example: The pattern
.Ic \&@(foo\&|bar)
only matches the strings
.Dq foo
.Ic \&| Ar pattern Ic \&)
.Xc
.Sm on
-Matches any string that does not match one of the specified patterns. Examples:
-The pattern
+Matches any string that does not match one of the specified patterns.
+Examples: The pattern
.Ic \&!(foo\&|bar)
matches all strings except
.Dq foo
.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
-the shell. Three exceptions to this are commands in pipelines, for which
+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,
asynchronous commands created when job control is disabled, for which standard
input is initially set to be from
.Ar file
does not exist, it is created; if it does exist, is a regular file and the
.Ic noclobber
-option is set, an error occurs; otherwise, the file is truncated. Note that
-this means the command
+option is set, an error occurs; otherwise, the file is truncated.
+Note that this means the command
.Ic cmd < foo > foo
will open
.Ar foo
.Ic \&> ,
except if
.Ar file
-exists it is appended to instead of being truncated. Also, the file is opened
+exists it is appended to instead of being truncated.
+Also, the file is opened
in append mode, so writes always go to the end of the file (see
.Fn open 2 ) .
.It Ic \&< Ar file
the shell copies lines from the command source into a temporary file until a
line matching
.Ar marker
-is read. When the command is executed, standard input is redirected from the
-temporary file. If
+is read.
+When the command is executed, standard input is redirected from the
+temporary file.
+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
.Pp
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
+redirection with a single digit.
+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
and
.Ar fd
-arguments of redirections. Note, however, that the results of any file name
+arguments of redirections.
+Note, however, that the results of any file name
generation are only used if a single file is matched; if multiple files match,
-the word with the expanded file name generation characters is used. Note
+the word with the expanded file name generation characters is used.
+Note
that in restricted shells, redirections which can create files cannot be used.
.Pp
For simple-commands, redirections may appear anywhere in the command; for
.Ic if
statements, etc.
.Pc ,
-any redirections must appear at the end. Redirections are processed after
+any redirections must appear at the end.
+Redirections are processed after
pipelines are created and in the order they are given, so
.Pp
.Ic cat /foo/bar 2\&>&1 \&> /dev/null \&| cat -n
.Tn NOT .
.It Ic \&+\&+
Increment; must be applied to a parameter (not a literal or other expression).
-The parameter is incremented by 1. When used as a prefix operator, the result
+The parameter is incremented by 1.
+When used as a prefix operator, the result
is the incremented value of the parameter; when used as a postfix operator, the
result is the original value of the parameter.
.It Ic \&-\&-
except the parameter is decremented by 1.
.It Ic \&,
Separates two arithmetic expressions; the left-hand side is evaluated first,
-then the right. The result is the value of the expression on the right-hand
-side.
+then the right.
+The result is the value of the expression on the right-hand side.
.It Ic =
Assignment; variable on the left is set to the value on the right.
.It Xo Ic \&*= /= \&+= \&-= \&<\&<=
.It Ic \&|\&|
Logical
.Tn OR ;
-the result is 1 if either argument is non-zero, 0 if not. The right
-argument is evaluated only if the left argument is zero.
+the result is 1 if either argument is non-zero, 0 if not.
+The right argument is evaluated only if the left argument is zero.
.It Ic \&&\&&
Logical
.Tn AND ;
-the result is 1 if both arguments are non-zero, 0 if not. The
-right argument is evaluated only if the left argument is non-zero.
+the result is 1 if both arguments are non-zero, 0 if not.
+The right argument is evaluated only if the left argument is non-zero.
.It Ic \&|
Arithmetic (bit-wise)
.Tn OR .
Less than; the result is 1 if the left argument is less than the right, 0 if
not.
.It Ic \&<= \&>= \&>
-Less than or equal, greater than or equal, greater than. See
+Less than or equal, greater than or equal, greater than.
+See
.Ic \&< .
.It Ic \&<\&< \&>\&>
Shift left (right); the result is the left argument with its bits shifted left
Addition, subtraction, multiplication, and division.
.It Ic %
Remainder; the result is the remainder of the division of the left argument by
-the right. The sign of the result is unspecified if either argument is
-negative.
+the right.
+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
.Ic \&>\&&p
and
.Ic \&<\&&p
-redirections, respectively. Once a co-process has been started, another can't
+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
redirected using an
.Ic exec Ar n Ns Ic \&>\&&p
-redirection. If a co-process's input is redirected in this way, the next
+redirection.
+If a co-process's input is redirected in this way, the next
co-process to be started will share the output with the first co-process,
unless the output of the initial co-process has been redirected using an
.Ic exec Ar n Ns Ic \&<\&&p
.Ic exec 3\&>\&&p\&; exec 3>\&>\&&\&- ) .
.It
In order for co-processes to share a common output, the shell must keep the
-write portion of the output pipe open. This means that end-of-file will not be
+write portion of the output pipe open.
+This means that end-of-file will not be
detected until all co-processes sharing the co-process output have exited
-(when they all exit, the shell closes its copy of the pipe). This can be
+(when they all exit, the shell closes its copy of the pipe).
+This can be
avoided by redirecting the output to a numbered file descriptor (as this also
-causes the shell to close its copy). Note that this behaviour is slightly
+causes the shell to close its copy).
+Note that this behaviour is slightly
different from the original Korn shell which closes its copy of the write
portion of the co-process output when the most recently started co-process
(instead of when all sharing co-processes) exits.
.Ic function Ar name
syntax or the Bourne/POSIX shell
.Fn name
-syntax (see below for the difference between the two forms). Functions are like
+syntax (see below for the difference between the two forms).
+Functions are like
.Li .-scripts
-in that they are executed in the current environment. However, unlike
+in that they are executed in the current environment.
+However, unlike
.Li .-scripts ,
shell arguments (i.e., positional parameters $1, $2, etc.) are never visible
-inside them. When the shell is determining the location of a command, functions
+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
.Ev PATH
executed, the shell searches the path specified in the
.Ev FPATH
parameter for a file with the same name as the function, which, if found, is
-read and executed. If after executing the file the named function is found to
+read and executed.
+If after executing the file the named function is found to
be defined, the function is executed; otherwise, the normal command search is
continued (i.e., the shell searches the regular built-in command table and
.Ev PATH ) .
.Ic typeset \&-ft
and
.Ic typeset \&-fx ,
-respectively. When a traced function is executed, the shell's
+respectively.
+When a traced function is executed, the shell's
.Ic xtrace
option is turned on for the function's duration; otherwise, the
.Ic xtrace
-option is turned off. The
+option is turned off.
+The
.Dq export
-attribute of functions is currently not used. In the original Korn shell,
+attribute of functions is currently not used.
+In the original Korn shell,
exported functions are visible to shell scripts that are executed.
.Pp
Since functions are executed in the current shell environment, parameter
assignments made inside functions are visible after the function completes.
If this is not the desired effect, the
.Ic typeset
-command can be used inside a function to create a local parameter. Note that
-special parameters (e.g., $$, $\&!) can't be scoped in this way.
+command can be used inside a function to create a local parameter.
+Note that special parameters (e.g., $$, $\&!) can't be scoped in this way.
.Pp
The exit status of a function is that of the last command executed in the
-function. A function can be made to finish immediately using the
+function.
+A function can be made to finish immediately using the
.Ic return
command; this may also be used to explicitly specify the exit status.
.Pp
.Ic getopts
inside a function interferes with using
.Ic getopts
-outside the function). In the future, the following differences will also be
-added:
+outside the function).
+In the future, the following differences will also be added:
.Bl -bullet -offset indent
.It
A separate trap/signal environment will be used during the execution of
-functions. This will mean that traps set inside a function will not affect the
+functions.
+This will mean that traps set inside a function will not affect the
shell's traps and signals that are not ignored in the shell (but may be
trapped) will have their default effect in a function.
.It
compliant; however, in some cases,
.Tn POSIX
behaviour is contrary either to the original Korn shell behaviour or to user
-convenience. How the shell behaves in these cases is determined by the state
-of the
+convenience.
+How the shell behaves in these cases is determined by the state of the
.Ic posix
option
.Pq Ic set Fl o Ic posix .
If it is on, the
.Tn POSIX
-behaviour is followed; otherwise, it is not. The
+behaviour is followed; otherwise, it is not.
+The
.Ic posix
option is set automatically when the shell starts up if the environment
contains the
.Dv POSIXLY_CORRECT
parameter. (The shell can also be compiled so that it is in
.Tn POSIX
-mode by
-default; however, this is usually not desirable).
+mode by default; however, this is usually not desirable).
.Pp
The following is a list of things that are affected by the state of the
.Ic posix
.Ic \e\&"
inside double quoted
.Ic `\&.\&.`
-command substitutions. In
+command substitutions.
+In
.Tn POSIX
mode, the
.Ic \e\&"
is interpreted when the command is interpreted; in
.Pf non- Tn POSIX
mode, the
-backslash is stripped before the command substitution is interpreted. For
-example,
+backslash is stripped before the command substitution is interpreted.
+For example,
.Ic echo \&"`echo \e\&"hi\e\&"`\&"
produces
.Dq \&"hi\&"
.Dq hi
in
.Pf non- Tn POSIX
-mode. To avoid problems, use the
+mode.
+To avoid problems, use the
.Ic $(...)
form of command substitution.
.It
.Ic kill -l
-output. In
+output.
+In
.Tn POSIX
mode, signal names are listed one per line; in
.Pf non- Tn POSIX
mode,
-signal numbers, names and descriptions are printed in columns. In future, a new
-option
+signal numbers, names and descriptions are printed in columns.
+In future, a new option
.Po Fl v
\ perhaps
.Pc
will be added to distinguish the two behaviours.
.It
.Ic fg
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status is 0 if no errors occur; in
.Pf non- Tn POSIX
mode, the exit status is that of the last foregrounded job.
.It
.Ic eval
-exit status. If
+exit status.
+If
.Ic eval
gets to see an empty command (i.e.,
.Ic eval "`false`" ) ,
its exit status in
.Tn POSIX
-mode will be 0. In
+mode will be 0.
+In
.Pf non- Tn POSIX
mode, it will be the exit status of the last command substitution that was
done in the processing of the arguments to
or
.Ql + .
.It
-Brace expansion (also known as alternation). In
+Brace expansion (also known as alternation).
+In
.Tn POSIX
mode, brace expansion is
disabled; in
.Pf non- Tn POSIX
-mode, brace expansion is enabled. Note that
+mode, brace expansion is enabled.
+Note that
.Ic set Fl o Ic posix
(or setting the
.Ev POSIXLY_CORRECT
mode, it does.
.It
.Ic set
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status of
.Ic set
mode, the exit status is that of any
command substitutions performed in generating the
.Ic set
-command. For example,
+command.
+For example,
.Ic set \&-\&- `false`; echo $?
prints 0 in
.Tn POSIX
mode, 1 in
.Pf non- Tn POSIX
-mode. This construct is used in most
-shell scripts that use the old
+mode.
+This construct is used in most shell scripts that use the old
.Xr getopt 1
command.
.It
.Ic readonly ,
and
.Ic typeset
-commands. In
+commands.
+In
.Tn POSIX
mode, normal argument expansion is done; in
.Pf non- Tn POSIX
field splitting, file globbing, brace expansion, and (normal) tilde expansion
are turned off, while assignment tilde expansion is turned on.
.It
-Signal specification. In
+Signal specification.
+In
.Tn POSIX
mode, signals can be specified as digits, only
if signal numbers match
.Pf non- Tn POSIX
mode, signals can always be digits.
.It
-Alias expansion. In
+Alias expansion.
+In
.Tn POSIX
mode, alias expansion is only carried out when
reading command words; in
.Pf non- Tn POSIX
mode, alias expansion is carried out on any
-word following an alias that ended in a space. For example, the following
+word following an alias that ended in a space.
+For example, the following
.Ic for
loop
.Pp
.Pf non- Tn POSIX
mode.
.It
-Test. In
+Test.
+In
.Tn POSIX
mode, the expression
.Dq Fl t
.Dq Ic \&!
arguments) is always true as it is a non-zero length string; in
.Pf non- Tn POSIX
-mode,
-it tests if file descriptor 1 is a tty (i.e., the
+mode, it tests if file descriptor 1 is a tty (i.e., the
.Ar fd
argument to the
.Fl t
.El
.Ss Command execution
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
.Ev PATH
-parameter. The checks are made in the above order. Special built-in commands
-differ from other commands in that the
+parameter.
+The checks are made in the above order.
+Special built-in commands differ from other commands in that the
.Ev PATH
parameter is not used to find them, and an error during their execution can
cause a non-interactive shell to exit and parameter assignments that are
-specified before the command are kept after the command completes. Just to
-confuse things, if the
+specified before the command are kept after the command completes.
+Just to confuse things, if the
.Ic posix
option is turned off (see
.Ic set
command below), some special commands are very special in that no field
splitting, file globbing, brace expansion, nor tilde expansion is performed
-on arguments that look like assignments. Regular built-in commands are
-different only in that the
+on arguments that look like assignments.
+Regular built-in commands are different only in that the
.Ev PATH
parameter is not used to find them.
.Pp
The original
-.Nm
+.Nm ksh
and
.Tn POSIX
differ somewhat in which commands are considered
.It Ic \&. Ar file Op Ar arg1 ...
Execute the commands in
.Ar file
-in the current environment. The file is searched for in the directories of
+in the current environment.
+The file is searched for in the directories of
.Ev PATH .
If arguments are given, the positional parameters may be used to access them
while
.Ar file
-is being executed. If no arguments are given, the positional parameters are
+is being executed.
+If no arguments are given, the positional parameters are
those of the environment the command is used in.
.It Ic \&: Op Ar ...
-The null command. Exit status is set to zero.
+The null command.
+Exit status is set to zero.
.It Xo Ic alias
.Op Fl d | Ic +-t Op Fl r
.Op Ic +-px
.Xc
Without arguments,
.Ic alias
-lists all aliases. For any name without a value, the existing alias is listed.
+lists all aliases.
+For any name without a value, the existing alias is listed.
Any name with a value defines an alias (see
.Sx Aliases
above).
.Pp
-When listing aliases, one of two formats is used. Normally, aliases are listed
-as
+When listing aliases, one of two formats is used.
+Normally, aliases are listed as
.Ar name Ns No = Ar value ,
where
.Ar value
-is quoted. If options were preceded with
+is quoted.
+If options were preceded with
.Ql + ,
or a lone
.Ql +
is given on the command line, only
.Ar name
-is printed. In addition, if the
+is printed.
+In addition, if the
.Fl p
option is used, each alias is prefixed with the string
.Dq alias\ \& .
The
.Fl t
option indicates that tracked aliases are to be listed/set (values specified on
-the command line are ignored for tracked aliases). The
+the command line are ignored for tracked aliases).
+The
.Fl r
option indicates that all tracked aliases are to be reset.
.Pp
.Sx Tilde expansion
above).
.It Ic bg Op Ar job ...
-Resume the specified stopped job(s) in the background. If no jobs are
-specified,
+Resume the specified stopped job(s) in the background.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+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
.Ar dir .
A
.Dv NULL
-path means the current directory. If
+path means the current directory.
+If
.Ar dir
is found in any component of the
.Ev CDPATH
.Ar dir
is missing, the home directory
.Ev HOME
-is used. If
+is used.
+If
.Ar dir
is
.Dq - ,
the previous working directory is used (see
.Ev OLDPWD
-parameter). If the
+parameter).
+If the
.Fl L
option (logical path) is used or if the
.Ic physical
.Dq \&.\&.
in
.Ar dir
-are relative to the path used to get to the directory. If the
+are relative to the path used to get to the directory.
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
option is set,
.Dq \&.\&.
-is relative to the filesystem directory tree. The
+is relative to the filesystem directory tree.
+The
.Ev PWD
and
.Ev OLDPWD
.Ar cmd
is executed exactly as if the
.Ic command
-had not been specified, with two exceptions. First,
+had not been specified, with two exceptions.
+First,
.Ar cmd
cannot be a shell function, and second, special built-in commands lose their
specialness (i.e., redirection and utility errors do not cause the shell to
-exit, and command assignments are not permanent). If the
+exit, and command assignments are not permanent).
+If the
.Fl p
option is given, a default search path is used instead of the current value of
.Ev PATH
printed; for aliases, a command that defines them is printed; and for commands
found by searching the
.Ev PATH
-parameter, the full path of the command is printed. If no command is found
+parameter, the full path of the command is printed.
+If no command is found
(i.e., the path search fails), nothing is printed and
.Ic command
-exits with a non-zero status. The
+exits with a non-zero status.
+The
.Fl V
option is like the
.Fl v
.Op Ar arg ...
.Xc
Prints its arguments (separated by spaces) followed by a newline, to the
-standard output. The newline is suppressed if any of the arguments contain the
+standard output.
+The newline is suppressed if any of the arguments contain the
backslash sequence
.Ql \ec .
See the
.Pp
The options are provided for compatibility with
.Bx
-shell scripts. The
+shell scripts.
+The
.Fl n
option suppresses the trailing newline,
.Fl e
.Pp
If no command is given except for I/O redirection, the I/O redirection is
permanent and the shell is
-not replaced. Any file descriptors greater than 2 which are opened or
+not replaced.
+Any file descriptors greater than 2 which are opened or
.Xr dup 2 Ns 'd
in this way are not made available to other executed commands (i.e., commands
-that are not built-in to the shell). Note that the Bourne shell differs here;
+that are not built-in to the shell).
+Note that the Bourne shell differs here;
it does pass these file descriptors on.
.It Ic exit Op Ar status
-The shell exits with the specified exit status. If
+The shell exits with the specified exit status.
+If
.Ar status
is not specified, the exit status is the current value of the
.Ic \&?
.It Xo Ic export Op Fl p
.Op Ar parameter Ns Op \&= Ns Ar value
.Xc
-Sets the export attribute of the named parameters. Exported parameters are
-passed in the environment to executed commands. If values are specified, the
-named parameters are also assigned.
+Sets the export attribute of the named parameters.
+Exported parameters are passed in the environment to executed commands.
+If values are specified, the named parameters are also assigned.
.Pp
If no parameters are specified, the names of all parameters with the export
attribute are printed one per line, unless the
.Ar first
and
.Ar last
-select commands from the history. Commands can be selected by history number
-or a string specifying the most recent command starting with that string. The
+select commands from the history.
+Commands can be selected by history number
+or a string specifying the most recent command starting with that string.
+The
.Fl l
option lists the command on stdout, and
.Fl n
-inhibits the default command numbers. The
+inhibits the default command numbers.
+The
.Fl r
-option reverses the order of the list. Without
+option reverses the order of the list.
+Without
.Fl l ,
the selected commands are edited by the editor specified with the
.Fl e
This command is usually accessed with the predefined
.Ic alias r='fx -e -' .
.It Ic fg Op Ar job ...
-Resume the specified job(s) in the foreground. If no jobs are specified,
+Resume the specified job(s) in the foreground.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+is assumed.
+This command is only available on systems which support job control (see
.Sx Job control
below for more information).
.It Xo Ic getopts Ar optstring name
.Ar optstring
contains the option letters that
.Ic getopts
-is to recognize. If a letter is followed by a colon, the option is expected to
-have an argument. Options that do not take arguments may be grouped in a single
-argument. If an option takes an argument and the option character is not the
+is to recognize.
+If a letter is followed by a colon, the option is expected to
+have an argument.
+Options that do not take arguments may be grouped in a single argument.
+If an option takes an argument and the option character is not the
last character of the argument it is found in, the remainder of the argument is
taken to be the option's argument; otherwise, the next argument is the option's
argument.
.Ar name
(indicating an illegal option or missing argument, respectively) and
.Ev OPTAG
-is set to the option character that caused the problem. An error message is
-also printed to standard error if
+is set to the option character that caused the problem.
+An error message is also printed to standard error if
.Ar optstring
does not being with a colon.
.Pp
When the end of the options is encountered,
.Ic getopts
-exits with a non-zero exit status. Options end at the first (non-option
+exits with a non-zero exit status.
+Options end at the first (non-option
argument) argument that does not start with a
.Ql - ,
or when a
.It Xo Ic hash Op Fl r
.Op Ar name ...
.Xc
-Without arguments, any hashed executable command pathnames are listed. The
+Without arguments, any hashed executable command pathnames are listed.
+The
.Fl r
-option causes all hashed commands to be removed from the hash table. Each
+option causes all hashed commands to be removed from the hash table.
+Each
.Ar name
is searched as if it were a command name and added to the hash table if it is
an executable command.
.Op Ar job ...
.Xc
Display information about the specified job(s); if no jobs are specified, all
-jobs are displayed. The
+jobs are displayed.
+The
.Fl n
option causes information to be displayed only for jobs that have changed
-state since the last notification. If the
+state since the last notification.
+If the
.Fl l
-option is used, the process ID of each process in a job is also listed. The
+option is used, the process ID of each process in a job is also listed.
+The
.Fl p
-option causes only the process group of each job to be printed. See
+option causes only the process group of each job to be printed.
+See
.Sx Job control
below for the format of
.Ar job
.Ar pgrp No } Ar ...
.Xc
Send the specified signal to the specified jobs, process IDs, or process
-groups. If no signal is specified, the
+groups.
+If no signal is specified, the
.Dv TERM
-signal is sent. If a job is specified, the signal is sent to the job's
-process group. See
+signal is sent.
+If a job is specified, the signal is sent to the job's process group.
+See
.Sx Job control
below for the format of
.Ar job .
.It Ic let Op Ar expression ...
Each expression is evaluated (see
.Sx Arithmetic expressions
-above). If all expressions are successfully evaluated, the exit status is 0 (1)
-if the last expression evaluated to non-zero (zero). If an error occurs during
+above).
+If all expressions are successfully evaluated, the exit status is 0 (1)
+if the last expression evaluated to non-zero (zero).
+If an error occurs during
the parsing or evaluation of an expression, the exit status is greater than 1.
Since expressions may need to be quoted,
.Ic (( Ar expr Ic ))
.Xc
.Ic print
prints its arguments on the standard output, separated by spaces and
-terminated with a newline. The
+terminated with a newline.
+The
.Fl n
-option suppresses the newline. By default, certain C escapes are translated.
+option suppresses the newline.
+By default, certain C escapes are translated.
These include
.Ql \eb ,
.Ql \ef ,
.Ql \e
expansion may be inhibited with the
.Fl r
-option. The
+option.
+The
.Fl s
option prints to the history file instead of standard output, the
.Fl u
.Ql \e
sequences unless the
.Fl e
-option is given. As above, the
+option is given.
+As above, the
.Fl n
option suppresses the trailing newline.
.It Ic pwd Op Fl LP
-Print the present working directory. If the
+Print the present working directory.
+If the
.Fl L
option is used or if the
.Ic physical
.Ic set
command below) isn't set, the logical path is printed (i.e., the path used to
.Ic cd
-to the current directory). If the
+to the current directory).
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
.Ev IFS
parameter (see
.Sx Substitution
-above), and assigns each field to the specified parameters. If there are more
-parameters than fields, the extra parameters are set to
+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
-is assigned the remaining fields (inclusive of any separating spaces). If no
-parameters are specified, the
+is assigned the remaining fields (inclusive of any separating spaces).
+If no parameters are specified, the
.Ev REPLY
-parameter is used. If the input line ends in a backslash and the
+parameter is used.
+If the input line ends in a backslash and the
.Fl r
option was not used, the backslash and the newline are stripped and more input
-is read. If no input is read,
+is read.
+If no input is read,
.Ic read
exits with a non-zero status.
.Pp
.Ar n
or the current co-process (see
.Sx Co-processes
-above for comments on this), respectively. If the
+above for comments on this), respectively.
+If the
.Fl s
option is used, input is saved to the history file.
.It Xo Ic readonly Op Fl p
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Sets the read-only attribute of the named parameters. If values are given,
-parameters are set to them before setting the attribute. Once a parameter is
+Sets the read-only attribute of the named parameters.
+If values are given,
+parameters are set to them before setting the attribute.
+Once a parameter is
made read-only, it cannot be unset and its value cannot be changed.
.Pp
If no parameters are specified, the names of all parameters with the read-only
.Ar status .
If no
.Ar status
-is given, the exit status of the last executed command is used. If used
-outside of a function or
+is given, the exit status of the last executed command is used.
+If used outside of a function or
.Ic \&.
script, it has the same effect as
.Ic exit .
All new parameters are created with the export attribute.
.It Fl b Ic notify
Print job notification messages asynchronously, instead of just before the
-prompt. Only used if job control is enabled
+prompt.
+Only used if job control is enabled
.Pq Fl m .
.It Fl C Ic noclobber
Prevent
Exit (after executing the
.Dv ERR
trap) as soon as an error occurs or a command fails (i.e., exits with a
-non-zero status). This does not apply to commands whose exit status is
+non-zero status).
+This does not apply to commands whose exit status is
explicitly tested by a shell construct such as
.Ic if ,
.Ic until ,
.It Fl h Ic trackall
Create tracked aliases for all executed commands (see
.Sx Aliases
-above). Enabled by default for non-interactive shells.
+above).
+Enabled by default for non-interactive shells.
.It Fl i Ic interactive
-Enable interactive mode. This can only be set/unset when the shell is invoked.
+Enable interactive mode.
+This can only be set/unset when the shell is invoked.
.It Fl k Ic keyword
Parameter assignments are recognized anywhere in a command.
.It Fl l Ic login
-The shell is a login shell. This can only be set/unset when the shell is
+The shell is a login shell.
+This can only be set/unset when the shell is
invoked (see
.Sx Shell startup
above).
.It Fl m Ic monitor
Enable job control (default for interactive shells).
.It Fl n lc noexec
-Do not execute any commands. Useful for checking the syntax of scripts
+Do not execute any commands.
+Useful for checking the syntax of scripts
(ignored if interactive).
.It Fl p Ic privileged
Set automatically if, when the shell starts, the read UID or GID does not match
-the effective UID (EUID) or GID (EGID), respectively. See
+the effective UID (EUID) or GID (EGID), respectively.
+See
.Sx Shell startup
above for a description of what this means.
.It Fl r Ic restricted
-Enable restricted mode. This option can only be used when the shell is invoked.
+Enable restricted mode.
+This option can only be used when the shell is invoked.
See
.Sx Shell startup
above for a description of what this means.
.It Fl s Ic stdin
-If used where the shell is invoked, commands are read from standard input. Set
-automatically if the shell is invoked with no arguments.
+If used where the shell is invoked, commands are read from standard input.
+Set automatically if the shell is invoked with no arguments.
.Pp
When
.Fl s
Enable BRL emacs-like command-line editing (interactive shells only); see
.Sx Emacs editing mode.
.It Ic gmacs
-Enable gmacs-like command-line editing (interactive shells only). Currently
-identical to emacs editing except that transpose (^T) acts slightly
+Enable gmacs-like command-line editing (interactive shells only).
+Currently identical to emacs editing except that transpose (^T) acts slightly
differently.
.It Ic ignoreeof
The shell will not (easily) exit when end-of-file is read;
.It Ic nohup
Do not kill running jobs with a
.Dv HUP
-signal when a login shell exists. Currently set by default, but this will
+signal when a login shell exists.
+Currently set by default, but this will
change in the future to be compatible with the original Korn shell (which
doesn't have this option, but does send the
.Dv HUP
signal).
.It Ic nolog
-No effect. In the original Korn shell, this prevents function definitions from
+No effect.
+In the original Korn shell, this prevents function definitions from
being stored in the history file.
.It Ic physical
Causes the
.Dq logical
directories (i.e., the shell handles
.Dq \&.\&. ,
-which allows the user to be oblivious of symbolic links to directories). Clear
-by default. Note that setting this option does not affect the current value of
-the
+which allows the user to be oblivious of symbolic links to directories).
+Clear by default.
+Note that setting this option does not affect the current value of the
.Ev PWD
parameter; only the
.Ic cd
.It Ic posix
Enable
.Tn POSIX
-mode. See
+mode.
+See
.Sx POSIX mode
above.
.It Ic vi
Enable vi-like command-line editing (interactive shells only).
.It Ic viraw
-No effect. In the original Korn shell, unless
+No effect.
+In the original Korn shell, unless
.Ic viraw
was set, the vi command-line mode would let the tty driver do the work until
.Tn ESC
which may cause problems.
.It Ic vi-tabcomplete
In vi command-line editing, do command and file name completion when tab (^I)
-is entered in insert mode. This is the default.
+is entered in insert mode.
+This is the default.
.El
.Pp
-These options can also be used upon invocation of the shell. The current set of
+These options can also be used upon invocation of the shell.
+The current set of
options (with single letter names) can be found in the parameter
.Dv \&- .
.Ic set Fl o
will print the long names of all options that are currently on.
.Pp
Remaining arguments, if any, are positional parameters and are assigned, in
-order, to the positional parameters (i.e., $1, $2, etc.). If options end with
+order, to the positional parameters (i.e., $1, $2, etc.).
+If options end with
.Ql --
-and there are no remaining arguments, all positional parameters are cleared. If
-no options or arguments are given, the values of all names are printed. For
-unknown historical reasons, a lone
+and there are no remaining arguments, all positional parameters are cleared.
+If no options or arguments are given, the values of all names are printed.
+For unknown historical reasons, a lone
.Ql -
option is treated specially -- it clears both the
.Fl x
evaluates the
.Ar expression
and returns zero status if true, 1 status if false, or greater than 1 if there
-was an error. It is normally used as the condition command of
+was an error.
+It is normally used as the condition command of
.Ic if
and
.Ic while
-statements. The following basic expressions are available:
+statements.
+The following basic expressions are available:
.Bl -tag -width 17n
.It Ar str
.Ar str
-has non-zero length. Note that there is the potential for problems if
+has non-zero length.
+Note that there is the potential for problems if
.Ar str
turns out to be an operator (e.g.,
.Fl r ) .
.Ar option
is set (see
.Ic set
-command above for a list of options). As a non-standard extension, if the
-option starts with a
+command above for a list of options).
+As a non-standard extension, if the option starts with a
.Ql ! ,
the test is negated; the test always fails if
.Ar option
.It Fl t Op Ar fd
File descriptor
.Ar fd
-is a tty device. If the
+is a tty device.
+If the
.Ic posix
option is not set,
.Ar fd
.Ic test
command will attempt to fake it for all tests that operate on files (except the
.Fl e
-test). For example,
+test).
+For example,
.Ic \&[ -w /dev/fd/2 \&]
tests if file descriptor 2 is writable.
.Pp
.Xc
If a
.Ar pipeline
-is given, the times used to execute the pipeline are reported. If no 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.
The times reported are the real time (elapsed time from start to finish),
.Dl user 0.00
.Dl sys 0.00
.Pp
-(the number of digits after the decimal may vary from system to system). Note
+(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
command:
.Pp
.Dv ALRM )
or the number of the signal (see
.Ic kill -l
-command above). There are two special signals:
+command above).
+There are two special signals:
.Dv EXIT
(also known as 0), which is executed when the shell is about to exit, and
.Dv ERR ,
.Ic set
command above).
.Dv EXIT
-handlers are executed in the environment of the last executed command. Note
+handlers are executed in the environment of the last executed command.
+Note
that for non-interactive shells, the trap handler cannot be changed for signals
that were ignored when the shell started.
.Pp
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Display or set parameter attributes. With no
+Display or set parameter attributes.
+With no
.Ar name
arguments, parameter attributes are displayed; if no options are used, the
current attributes of all parameters are printed as
.Pq Ic \&-
or cleared
.Pq Ic \&+ .
-Values for parameters may optionally be specified. If
+Values for parameters may optionally be specified.
+If
.Ic typeset
is used inside a function, any newly created parameters are local to the
function.
.Fl f
is used,
.Ic typeset
-operates on the attributes of functions. As with parameters, if no
+operates on the attributes of functions.
+As with parameters, if no
.Ar name Ns s
are given, functions are listed with their values (i.e., definitions) unless
options are introduced with
.It Fl L Ns Ar n
Left justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Leading whitespace (and zeros, if used with the
+assigned value) is used.
+Leading whitespace (and zeros, if used with the
.Fl Z
-option) is stripped. If necessary, values are either truncated or space padded
+option) is stripped.
+If necessary, values are either truncated or space padded
to fit the field width.
.It Fl R Ns Ar n
Right justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Trailing whitespace is stripped. If necessary, values
+assigned value) is used.
+Trailing whitespace is stripped.
+If necessary, values
are either stripped of leading characters or space padded to make them fit the
field width.
.It Fl Z Ns Ar n
-Zero fill attribute. If not combined with
+Zero fill attribute.
+If not combined with
.Fl L ,
this is the same as
.Fl R ,
Integer attribute.
.Ar n
specifies the base to use when displaying the integer (if not specified, the
-base given in the first assignment is used). Parameters with this attribute may
+base given in the first assignment is used).
+Parameters with this attribute may
be assigned values containing arithmetic expressions.
.It Fl U
-Unsigned integer attribute. Integers are printed as unsigned values (only
+Unsigned integer attribute.
+Integers are printed as unsigned values (only
useful when combined with the
.Fl i
-option). This option is not in the original Korn shell.
+option).
+This option is not in the original Korn shell.
.It Fl f
-Function mode. Display or set functions and their attributes, instead of
-parameters.
+Function mode.
+Display or set functions and their attributes, instead of parameters.
.It Fl l
-Lower case attribute. All upper case characters in values are converted to
-lower case. (In the original Korn shell, this parameter meant
+Lower case attribute.
+All upper case characters in values are converted to lower case.
+(In the original Korn shell, this parameter meant
.Dq long integer
when used with the
.Fl i
Print complete
.Ic typeset
commands that can be used to re-create the attributes (but not the values) or
-parameters. This is the default action (option exists for ksh93 compatibility).
+parameters.
+This is the default action (option exists for ksh93 compatibility).
.It Fl r
-Read-only attribute. Parameters with this attribute may not be assigned to or
-unset. Once this attribute is set, it can not be turned off.
+Read-only attribute.
+Parameters with this attribute may not be assigned to or unset.
+Once this attribute is set, it can not be turned off.
.It Fl t
-Tag attribute. Has no meaning to the shell; provided for application use.
+Tag attribute.
+Has no meaning to the shell; provided for application use.
.Pp
For functions,
.Fl t
-is the trace attribute. When functions with the trace attribute are executed,
-the
+is the trace attribute.
+When functions with the trace attribute are executed, the
.Ic xtrace
.Pq Fl x
shell option is temporarily turned on.
.It Fl u
-Upper case attribute. All lower case characters in values are converted to
-upper case. (In the original Korn shell, this parameter meant
+Upper case attribute.
+All lower case characters in values are converted to upper case.
+(In the original Korn shell, this parameter meant
.Dq unsigned integer
when used with the
.Fl i
option, which meant upper case letters would never be used for bases greater
-than 10. See the
+than 10.
+See the
.Fl U
option.)
.Pp
For functions,
.Fl u
-is the undefined attribute. See
+is the undefined attribute.
+See
.Sx Functions
above for the implications of this.
.It Fl x
-Export attribute. Parameters (or functions) are placed in the environment of
-any executed commands. Exported functions are not yet implemented.
+Export attribute.
+Parameters (or functions) are placed in the environment of
+any executed commands.
+Exported functions are not yet implemented.
.El
.It Xo Ic ulimit Op Fl acdfHlmnpsStvw
.Op Ar value
.Xc
-Display or set process limits. If no options are used, the file size limit
+Display or set process limits.
+If no options are used, the file size limit
.Pq Fl f
is assumed.
.Ar value ,
if specified, may be either an arithmetic expression or the word
.Dq unlimited .
The limits affect the shell and any processes created by the shell after a
-limit is imposed. Note that some systems may not allow limits to be increased
-once they are set. Also note that the types of limits available are system
+limit is imposed.
+Note that some systems may not allow limits to be increased
+once they are set.
+Also note that the types of limits available are system
dependent -- some systems have only the
.Fl f
limit.
.It Xo Ic unalias Op Fl adt
.Op Ar name1 ...
.Xc
-The aliases for the given names are removed. If the
+The aliases for the given names are removed.
+If the
.Fl a
-option is used, all aliases are removed. If the
+option is used, all aliases are removed.
+If the
.Fl t
or
.Fl d
The exit status is non-zero if any of the parameters were already unset, zero
otherwise.
.It Ic wait Op Ar job ...
-Wait for the specified job(s) to finish. The exit status of
+Wait for the specified job(s) to finish.
+The exit status of
.Ic wait
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
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. See
+is 127.
+See
.Sx Job control
below for the format of
.Ar job .
If no jobs are specified,
.Ic wait
waits for all currently running jobs (if any) to finish and exits with a zero
-status. If job monitoring is enabled, the completion status of jobs is printed
+status.
+If job monitoring is enabled, the completion status of jobs is printed
(this is not the case when jobs are explicitly specified).
.It Xo Ic whence Op Fl pv
.Op Ar name ...
For each
.Ar name ,
the type of command is listed (reserved word, built-in, alias,
-function, tracked alias, or executable). If the
+function, tracked alias, or executable).
+If the
.Fl p
option is used, a path search is performed even if
.Ar name
-is a reserved word, alias, etc. Without the
+is a reserved word, alias, etc.
+Without the
.Fl v
option,
.Ic whence
.Ic command Fl v
except that
.Ic whence
-will find reserved words and won't print aliases as alias commands. With the
+will find reserved words and won't print aliases as alias commands.
+With the
.Fl v
option,
.Ic whence
.El
.Ss Job control
Job control refers to the shell's ability to monitor and control jobs, which
-are processes or groups of processes created for commands or pipelines. At a
-minimum, the shell keeps track of the status of the background (i.e.,
+are processes or groups of processes created for commands or pipelines.
+At a minimum, the shell keeps track of the status of the background (i.e.,
asynchronous) jobs that currently exist; this information can be displayed
using the
.Ic jobs
-commands. If job control is fully enabled (using
+commands.
+If job control is fully enabled (using
.Ic set Fl m
or
.Ic set Fl o Ic monitor ) ,
as it is for interactive shells, the processes of a job are placed in their
-own process group. Foreground jobs can be stopped by typing the suspend
+own process group.
+Foreground jobs can be stopped by typing the suspend
character from the terminal (normally ^Z), jobs can be restarted in either the
foreground or background using the
.Ic fg
.Ic read
cannot be.
.Pp
-When a job is created, it is assigned a job number. For interactive shells,
-this number is printed inside
+When a job is created, it is assigned a job number.
+For interactive shells, this number is printed inside
.Dq \&[..\&] ,
followed by the process IDs of the processes in the job when an asynchronous
-command is run. A job may be referred to in
+command is run.
+A job may be referred to in
.Ic bg ,
.Ic fg ,
.Ic jobs ,
.It Ar signal-description Op Dq core dumped
The job was killed by a signal (e.g., memory fault, hangup, etc.; use
.Ic kill -l
-for a list of signal descriptions). The
+for a list of signal descriptions).
+The
.Dq core dumped
message indicates the process created a core file.
.El
.It Ar command
-is the command that created the process. If there are multiple processes in
+is the command that created the process.
+If there are multiple processes in
the job, each process will have a line showing its
.Ar command
and possibly its
If another attempt is immediately made to exit the shell, the stopped jobs are
sent a
.Dv SIGHUP
-signal and the shell exits. Similarly, if the
+signal and the shell exits.
+Similarly, if the
.Ic nohup
option is not set and there are running jobs when an attempt is made to exit
-a login shell, the shell warns the user and does not exit. If another attempt
+a login shell, the shell warns the user and does not exit.
+If another attempt
is immediately made to exit the shell, the running jobs are sent a
.Dv SIGHUP
signal and the shell exits.
.Ss Emacs editing mode
When the
.Ic emacs
-option is set, interactive input line editing is enabled. Warning: This mode is
+option is set, interactive input line editing is enabled.
+Warning: This mode is
slightly different from the emacs mode in the original Korn shell and the 8th
-bit is stripped in emacs mode. In this mode, various editing commands
+bit is stripped in emacs mode.
+In this 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
+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
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
+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
+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.
+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
string, which may contain editing commands.
.El
.Pp
-The following is a list of available editing commands. Each description starts
-with the name of the command, an
+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
bound to by default (written using caret notation, i.e.,
.Tn "ASCII ESC"
character is
-written as ^[). A count prefix for a command is entered using the sequence
+written as ^[).
+A count prefix for a command is entered using the sequence
.Ic ^\&[ Ns Ar n ,
where
.Ar n
is a sequence of 1 or more digits; unless otherwise specified, if a count is
-omitted, it defaults to 1. Note that editing command names are used only with
-the
+omitted, it defaults to 1.
+Note that editing command names are used only with the
.Ic bind
-command. Furthermore, many editing commands are useful only on terminals with
-a visible cursor. The default bindings were chosen to resemble corresponding
-Emacs key bindings. The users' tty characters (e.g.,
+command.
+Furthermore, many editing commands are useful only on terminals with
+a visible cursor.
+The default bindings were chosen to resemble corresponding
+Emacs key bindings.
+The users' tty characters (e.g.,
.Dv ERASE )
are bound to
reasonable substitutes and override the default bindings.
.Ic search-history
pattern in order to about the search.
.It Ic auto-insert Ar n
-Simply causes the character to appear as literal input. Most ordinary
-characters are bound to this.
+Simply causes the character to appear as literal input.
+Most ordinary characters are bound to this.
.It Ic backward-char Ar n Ic ^B
Moves the cursor backward
.Ar n
.It Ic complete ^[^[
.It Ic complete ^I
Automatically completes as much as is unique of the command name or the file
-name containing the cursor. If the entire remaining command or file name is
+name containing the cursor.
+If the entire remaining command or file name is
unique, a space is printed after its completion, unless it is a directory name
in which case
.Ql /
-is appended. If there is no command or file name with the current partialword
+is appended.
+If there is no command or file name with the current partialword
as its prefix, a bell character is output (usually causing a beep to be
sounded).
.It Ic complete-command ^X^[
.It Ic down-history Ar n Ic ^N
Scrolls the history buffer forward
.Ar n
-lines (later). Each input line originally starts just after the last entry
+lines (later).
+Each input line originally starts just after the last entry
in the history buffer, so
.Ic down-history
is not useful until either
Appends a
.Ql *
to the current word and replaces the word with the result of performing file
-globbing on the word. If no files match the pattern, the bell is rung.
+globbing on the word.
+If no files match the pattern, the bell is rung.
.It Ic forward-char Ar n Ic ^F
Moves the cursor forward
.Ar n
.Ar n .
.It Ic list ^[?
Prints a sorted, columnated list of command named or file names (if any) that
-can complete the partial word containing the cursor. Directoary names have
+can complete the partial word containing the cursor.
+Directoary names have
.Ql /
appended to them.
.It Ic list-command ^X?
the partial word containg the cursor.
.It Ic list-file ^X^Y
Prints a sorted, comunated list of file names (if any) that can complete the
-partial word containing the cursor. File type indicators are appended as
-described under
+partial word containing the cursor.
+File type indicators are appended as described under
.Ic list
above.
.It Ic newline ^J , ^M
-Causes the current input line to be processed by the shell. The current cursor
-position may be anywhere on the line.
+Causes the current input line to be processed by the shell.
+The current cursor position may be anywhere on the line.
.It Ic newline-and-next ^O
Causes the current input line to be processed by the shell, and the next line
-from history becomes the current line. This is only useful after an
+from history becomes the current line.
+This is only useful after an
.Ic up-history
or
.ic search-history .
.Ar n Ns th
occurrence of the next character typed.
.It Ic search-history ^R
-Enter incremental search mode. The internal history list is searched
-backwards for commands matching the input. An initial
+Enter incremental search mode.
+The internal history list is searched
+backwards for commands matching the input.
+An initial
.Ql ^
-in the search string anchors the search. The abort key will leave search mode.
-Other commands will be executed after leaving search mode. Successive
+in the search string anchors the search.
+The abort key will leave search mode.
+Other commands will be executed after leaving search mode.
+Successive
.Ic search-history
commands continue searching backward to the next previous occurrence of the
-pattern. The history buffer retains only a finite number of lines; the oldest
+pattern.
+The history buffer retains only a finite number of lines; the oldest
are discarded as necessary.
.It Ic set-mark-command ^[ Ns No <space>
Set the mark at the cursor position.
.It Ic stuff
On systems supporting it, puhses the bound character back onto the terminal
-input where it may receive special processing by the terminal handler. This
-is useful for the BRL ^T mini-systat feature, for example.
+input where it may receive special processing by the terminal handler.
+This is useful for the BRL ^T mini-systat feature, for example.
.It Ic stuff-reset
Acts like
.Ic stuff ,
.Ar n
words.
.It Ic version ^V
-Display the version of ksh. The current edit buffer is restored as soon as any
+Display the version of ksh.
+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
Inserts the most recently killed text string at the current cursor position.
.Dq insert
mode and
.Dq command
-mode. In insert mode, most characters are simply put in the buffer at the
+mode.
+In insert mode, most characters are simply put in the buffer at the
current cursor position as they are typed; however, some characters are
-treated specially. In particular, the following characters are taken from
+treated specially.
+In particular, the following characters are taken from
current tty 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). In addition to
+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
.It Ic ^H
Erases previous character.
.It Ic ^V
-Liternal next. The next character typed is not treated specially (can be used
+Liternal next.
+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.
+End of line.
+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
Command and file name enumeration (see below).
.It Ic ^F
-Command and file name completion (see below). If used twice in a row, the
+Command and file name completion (see below).
+If used twice in a row, the
list of possible completions is displayed; if used a third time, the completion
is undone.
.It Ic ^X
.Ic set Fl o Ic vi-tabcomplete .
.El
.Pp
-In command mode, each character is interpreted as a command. Characters that
+In command mode, each character is interpreted as a command.
+Characters that
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
+commands that can't be carried out all cause beeps.
+In the following command descriptions, an
.Ar n
indicates the command may be prefixed by a number (e.g.,
.Ic 10l
moves right 10 characters); if no number prefix is used,
.Ar n
-is assumed to be 1 unless otherwise specified. The term
+is assumed to be 1 unless otherwise specified.
+The term
.Dq current position
refers to the position between the cursor and the character preceding the
-cursor. A
+cursor.
+A
.Dq word
is a sequence of letters, digits and underscore characters or a sequence of
non-letter, non-digit, non-underscore, non-whitespace characters (e.g.,
.Ar n
using the vi editor; if
.Ar n
-is not specified, the current line is edited. The actual command executed is
+is not specified, the current line is edited.
+The actual command executed is
.Ic fc Fl e Ic ${VISUAL;-${EDITOR:-vi}} Ar n .
.It Ic \&* No and Ic ^X
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
-with the resulting words. If the current big-word is the first on the line (or
+with the resulting words.
+If the current big-word is the first on the line (or
follows one of the following characters:
.Ql \&; ,
.Ql | ,
built-in commands as well as any executable files found by searching the
directories in the
.Ev PATH
-parameter. File name expansion matches the big-word against the files in the
-current directory. After expansion, the cursor is places just past the last
+parameter.
+File name expansion matches the big-word against the files in the
+current directory.
+After expansion, the cursor is places just past the last
word and the editor is in insert mode.
.It n\e,\ n^F,\ n<tab>,\ and\ n<esc>
-Command/file name completion. Replace the current big-word with the
+Command/file name completion.
+Replace the current big-word with the
longest unique match obtained after performing command and file name expansion.
.Ic <tab>
is only recognized if the
possible completion is selected (as reported by the command/file name
enumeration command).
.It Ic \&= No and Ic ^E
-Command/file name enumeration. List all the commands or files that match the
-current big-word.
+Command/file name enumeration.
+List all the commands or files that match the current big-word.
.It Ic ^V
Display the version of
.Nm pdksh ;
it is displayed until another key is pressed (this key is ignored).
.It Ic @ Ns Ar c
-Macro expansion. Execute the commands found in the alias
+Macro expansion.
+Execute the commands found in the alias
.Ar c .
.El
.Pp
.Ar n
big-words.
.It Ic %
-Find match. The editor looks forward for the nearest parenthesis, bracket or
+Find match.
+The editor looks forward for the nearest parenthesis, bracket or
brace and then moves the cursor to the matching parenthesis, bracket or brace.
.It Ar n Ns Ic f Ns Ar c
Move forward to the
.It Ar n Ns Ic a
Append text
.Ar n
-times; goes into insert mode just after the current position. The append is
+times; goes into insert mode just after the current position.
+The append is
only replicated if command mode is re-entered (i.e., <esc> is used).
.It Ar n Ns Ic A
Same as
.It Ar n Ns Ic i
Insert text
.Ar n
-times; goes into insert mode at the current position. The insertion is only
+times; goes into insert mode at the current position.
+The insertion is only
replicated if command mode is re-entered (i.e., <esc> is used).
.It Ar n Ns Ic I
Same as
.Ar n
characters (i.e., delete the characters and go into insert mode).
.It Ic S
-Substitute whole line. All characters from the first non-blank character to the
+Substitute whole line.
+All characters from the first non-blank character to the
end of the line are deleted and insert mode is entered.
.It Ar n Ns Ic c Ns Ar move-cmd
Change from the current position to the position resulting from
characters with the character
.Ar c .
.It Ar n Ns Ic R
-Replace. Enter insert mode but overwrite existing characters instead of
-inserting before existing characters. The replacement is repeated
+Replace.
+Enter insert mode but overwrite existing characters instead of
+inserting before existing characters.
+The replacement is repeated
.Ar n
times.
.It Ar n Ns Ic \&~
.Sh BUGS
Any bugs in
.Nm pdksh
-should be reported to pdksh@cs.mun.ca. Please include the version of
+should be reported to pdksh@cs.mun.ca.
+Please include the version of
.Nm pdksh
.Po
.Ic echo $KSH_VERSION
.Pa config.h
(the file generated by the
.Pa configure
-script). New version of
+script).
+New versions of
.Nm pdksh
can be obtained from ftp://ftp.cs.mun.ca/pub/pdksh.
.Pp
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
-Ron Natalie, Arnold Robbins, Lou Salkind, and others. The first release of
+Ron Natalie, Arnold Robbins, Lou Salkind, and others.
+The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
-The current maintainer is Michael Rendell (michael@cs.mun.ca). The
+The current maintainer is Michael Rendell (michael@cs.mun.ca).
+The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
-.\" $OpenBSD: ksh.1tbl,v 1.30 2000/03/14 20:25:46 aaron Exp $
+.\" $OpenBSD: ksh.1tbl,v 1.31 2000/03/17 18:15:16 aaron Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.Sh DESCRIPTION
.Nm ksh
is a command interpreter intended for both interactive and shell
-script use. Its command language is a superset of the
+script use.
+Its command language is a superset of the
.Xr sh 1
shell language.
.Ss Shell startup
nor the
.Fl s
option is specified, the first non-option argument specifies the name
-of a file the shell reads commands from. If there are no non-option
-arguments, the shell reads commands from the standard input. The name of
+of a file the shell reads commands from.
+If there are no non-option
+arguments, the shell reads commands from the standard input.
+The name of
the shell (i.e., the contents of $0) is determined as follows: if the
.Fl c
option is used and there is a non-option argument, it is used as the name;
if the
.Fl i
option is used or if both standard input and standard error are attached
-to a tty. An interactive shell has job control enabled (if available),
-ignores the
+to a tty.
+An interactive shell has job control enabled (if available), ignores the
.Dv SIGINT ,
.Dv SIGQUIT ,
and
.Pa $HOME/.profile
nor the
.Ev ENV
-parameter (see below). Instead, the file
+parameter (see below).
+Instead, the file
.Pa /etc/suid_profile
-is processed. Clearing the privileged option causes the shell to set
+is processed.
+Clearing the privileged option causes the shell to set
its effective user ID (group ID) to its real user ID (group ID).
.Pp
If the basename of the name the shell is called with (i.e., argv[0])
command, arithmetic, and tilde
.Pq Sq \&~
substitution and the resulting file
-(if any) is read and executed. If the
+(if any) is read and executed.
+If the
.Ev ENV
parameter is not set (and not
.Dv NULL )
.Pp
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,
+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
command is executed.
.Ss Command syntax
.Ql \&)
.Pc .
Aside from delimiting words, spaces and tabs are ignored, while newlines
-usually delimit commands. The meta-characters are used in building the
-following tokens:
+usually delimit commands.
+The meta-characters are used in building the following tokens:
.Ql < ,
.Ql <& ,
.Ql > ,
.Pq Sq \&"
or single
.Pq Sq \&'
-quotes. Note that the following characters are also treated specially by the
+quotes.
+Note that the following characters are also treated specially by the
shell and must be quoted if they are to represent themselves:
.Ql \e ,
.Ql \&" ,
.Sx Input/output redirections
below),
and command words; the only restriction is that parameter assignments come
-before any command words. The command words, if any, define the command
-that is to be executed and its arguments. The command may be a shell built-in
+before any command words.
+The command words, if any, define the command
+that is to be executed and its arguments.
+The command may be a shell built-in
command, a function or an external command (i.e., a separate executable file
that is located using the
.Ev PATH
be executed, the exit status is 126); the exit status of other command
constructs (built-in commands, functions, compound-commands, pipelines, lists,
etc.) are all well-defined and are described where the construct is
-described. The exit status of a command consisting only of parameter
+described.
+The exit status of a command consisting only of parameter
assignments is that of the last command substitution performed during the
parameter assignment or 0 is there were no command substitutions.
.Pp
token to form pipelines, in which the standard output of each command but the
last is piped (see
.Xr pipe 2 )
-to the standard input of the following command. The exit status of a pipeline
-is that of its last command. A pipeline may be prefixed by the
+to the standard input of the following command.
+The exit status of a pipeline is that of its last command.
+A pipeline may be prefixed by the
.Ql !
reversed word which causes the exit status of the pipeline to be logically
complemented: if the original status was 0 the complemented status will be 1;
.Ql |&
and
.Ql \&; ,
-which also have equal precedence. The
+which also have equal precedence.
+The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
the shell starts the command but does not wait for it to complete (the shell
does keep track of the status of asynchronous commands, see
.Sx Job control
-below). When an asynchronous command is started when job control is disabled
+below).
+When an asynchronous command is started when job control is disabled
(i.e., in most scripts), the command is started with signals
.Dv SIGINT
and
operator starts a co-process which is a special kind of asynchronous process
(see
.Sx Co-processes
-below). Note that a command must follow the
+below).
+Note that a command must follow the
.Ql &&
and
.Ql ||
The exit status of a list is that of the last command executed, with the
exception of asynchronous lists, for which the exit status is 0.
.Pp
-Compound commands are created using the following reserved words. These words
+Compound commands are created using the following reserved words.
+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):
.Sy Note:
Some shells (but not this one) execute control structure commands in a
subshell when one or more of their file descriptors are redirected, so any
-environment changes inside them may fail. To be portable, the
+environment changes inside them may fail.
+To be portable, the
.Ic exec
statement should be used instead to redirect file descriptors before the
control structure.
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
-a (syntactically correct) reserved word. For example,
+a (syntactically correct) reserved word.
+For example,
.Pp
.Bl -inset -indent -compact
.It Ic { echo foo; echo bar; }
.It Ic \&( Ar list Ic \&)
Execute
.Ar list
-in a subshell. There is no implicit way to pass environment changes from a
+in a subshell.
+There is no implicit way to pass environment changes from a
subshell back to its parent.
.It Ic \&{ Ar list Ic \&}
Compound construct;
.Ar list
-is executed, but not in a subshell. Note that
+is executed, but not in a subshell.
+Note that
.Ic \&{
and
.Ic \&}
.Ar pattern Ns s ;
the
.Ar list
-associated with the first successfully matched pattern is executed. Patterns
-used in
+associated with the first successfully matched pattern is executed.
+Patterns used in
.Ic case
statements are the same as those used for file name patterns except that the
restrictions regarding
.Ql \&.
and
.Ql /
-are dropped. Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted. Both the word and the
-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
+are dropped.
+Note that any unquoted space before and after a pattern is
+stripped; any space with a pattern must be quoted.
+Both the word and the
+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
and
.Ic esac
.Ar name
is set to the word and
.Ar list
-is executed. If
+is executed.
+If
.Ic in
is not used to specify a word list, the positional parameters ($1, $2, etc.)
-are used instead. For historical reasons, open and close braces may be used
-instead of
+are used instead.
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Ar list
following the
.Ic elif ,
-if any, is executed with similar consequences. If all the lists following
-the
+if any, is executed with similar consequences.
+If all the lists following the
.Ic if
and
.Ic elif Ns s
.Ar list
following the
.Ic else
-is executed. The exit status of an
+is executed.
+The exit status of an
.Ic if
statement is that of non-conditional
.Ar list
The
.Ic select
statement provides an automatic method of presenting the user with a menu and
-selecting from it. An enumerated list of the specified
+selecting from it.
+An enumerated list of the specified
.Ar word Ns s
is printed on standard error, followed by a prompt
.Po
.Ev REPLY
is
.Dv NULL ,
-the prompt is printed and so on. This process continues until an end-of-file
+the prompt is printed and so on.
+This process continues until an end-of-file
is read, an interrupt is received, or a
.Ic break
-statement is executed inside the loop. If
+statement is executed inside the loop.
+If
.Ic in Ar word Ar ...
-is omitted, the positional parameters are used (i.e., $1, $2, etc.). For
-historical reasons, open and close braces may be used instead of
+is omitted, the positional parameters are used (i.e., $1, $2, etc.).
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Xc
A
.Ic while
-is a pre-checked loop. Its body is executed as often as the exit status of
-the first
+is a pre-checked loop.
+Its body is executed as often as the exit status of the first
.Ar list
-is zero. The exit status of a
+is zero.
+The exit status of a
.Ic while
statement is the last exit status of the
.Ar list
.Ar name
(see
.Sx Functions
-below). Note that redirections specified after a function definition are
+below).
+Note that redirections specified after a function definition are
performed whenever the function is executed, not when the function definition
is executed.
.It Ar name Ic () Ar command
.Ql &&
and
.Ql ||
-operators. This means that in the statement
+operators.
+This means that in the statement
.Pp
.Ic \&[[ -r foo && $(< foo) = b*r ]]
.Pp
.El
.Ss Quoting
Quoting is used to prevent the shell from treating characters or words
-specially. There are three methods of quoting. First,
+specially.
+There are three methods of quoting.
+First,
.Ql \e
quotes the following character, unless it is at the end of a line, in which
case both the
.Ql \e
-and the newline are stripped. Second, a single quote
+and the newline are stripped.
+Second, a single quote
.Pq Sq '
-quotes everything up to the next single quote (this may span lines). Third,
-a double quote
+quotes everything up to the next single quote (this may span lines).
+Third, a double quote
.Pq Sq \&"
quotes all characters, except
.Ql $ ,
.Ql `
inside double quotes have their usual meaning (i.e., parameter, command or
arithmetic substitution) except no field splitting is carried out on the
-results of double-quoted substitutions. If a
+results of double-quoted substitutions.
+If a
.Ql \e
inside a double-quoted string is followed by
.Ql \e ,
.Ss Aliases
There are two types of aliases: normal command aliases and tracked aliases.
Command aliases are normally used as a short hand for a long or often used
-command. The shell expands command aliases (i.e., substitutes the alias name
-for its value) when it reads the first word of a command. An expanded alias
-is re-processed to check for more aliases. If a command alias ends in a
-space or tab, the following word is also checked for alias expansion. The
-alias expansion process stops when a word that is not an alias is found, when
-a quoted word is found or when an alias word that is currently being expanded
-is found.
+command.
+The shell expands command aliases (i.e., substitutes the alias name
+for its value) when it reads the first word of a command.
+An expanded alias is re-processed to check for more aliases.
+If a command alias ends in a
+space or tab, the following word is also checked for alias expansion.
+The alias expansion process stops when a word that is not an alias is found,
+when a quoted word is found or when an alias word that is currently being
+expanded is found.
.Pp
The following command aliases are defined automatically by the shell:
.Pp
.El
.Pp
Tracked aliases allow the shell to remember where it found a particular
-command. 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
+command.
+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. Tracked aliases
-can be listed and created using
+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
.Ev PATH
-parameter clears the saved paths for all tracked aliases. If the
+parameter clears the saved paths for all tracked aliases.
+If the
.Ic trackall
option is set (i.e.,
.Ic set Fl o Ic trackall
or
.Ic set Fl h ) ,
-the shell tracks all commands. This option is set automatically for
-non-interactive shells. For interactive shells, only the following commands are
+the shell tracks all commands.
+This option is set automatically for
+non-interactive shells.
+For interactive shells, only the following commands are
automatically tracked:
.Ic cat , cc , chmod , cp ,
.Ic date , ed , emacs , grep ,
.Ic who .
.Ss Substitution
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. Parameter substitutions,
+substitutions on the words of the command.
+There are three kinds of
+substitution: parameter, command, and arithmetic.
+Parameter substitutions,
which are described in detail in the next section, take the form
.Ic $ Ns Ar name
or
substitution are generally subject to word or field splitting according to
the current value of the
.Ev IFS
-parameter. The
+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
whitespace characters, in combination with zero or no
.Pf non- Ev IFS
whitespace
-characters, delimit a field. As a special case, leading and trailing
+characters, delimit a field.
+As a special case, leading and trailing
.Ev IFS
whitespace is stripped (i.e., no leading or trailing empty field is created by
it); leading or trailing
brace expansion and file name expansion (see the relevant sections below).
.Pp
A command substitution is replaced by the output generated by the specified
-command, which is run in a subshell. For
+command, which is run in a subshell.
+For
.Ic $( Ns Ar command Ns Ic \&)
substitutions, normal quoting rules are used when
.Ar command
.Ql \e
is stripped (a
.Ql \e
-followed by any other character is unchanged). As a special case in command
-substitutions, a command of the form
+followed by any other character is unchanged).
+As a special case in command substitutions, a command of the form
.Ic \&< Ar file
is interpreted to mean substitute the contents of
.Ar file
.Sy Note:
.Ic $( Ns Ar command Ns Ic \&)
expressions are currently parsed by finding the matching parenthesis,
-regardless of quoting. This should be fixed soon.
+regardless of quoting.
+This should be fixed soon.
.Pp
Arithmetic substitutions are replaced by the value of the specified expression.
For example, the command
.Ic echo $((2+3*4))
-prints 14. See
+prints 14.
+See
.Sx Arithmetic expressions
for a description of an expression.
.Ss Parameters
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
+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
.Po
.Pc
is set, in which case an error occurs.
.Pp
-Parameters can be assigned valued in a number of ways. First, the shell
-implicitly sets some parameters like
+Parameters can be assigned valued in a number of ways.
+First, the shell implicitly sets some parameters like
.Ic # , PWD ,
etc.; this is the only way the special single character parameters are set.
-Second, parameters are imported from the shell's environment at startup. Third,
-parameters can be assigned values on the command line, for example,
+Second, parameters are imported from the shell's environment at startup.
+Third, parameters can be assigned values on the command line, for example,
.Ic FOO=bar
sets the parameter
.Ev FOO
multiple parameter assignments can be given on a single command line and they
can be followed by a simple-command, in which case the assignments are in
effect only for the duration of the command (such assignments are also
-exported, see below for implications of this). Note that both the parameter
-name and the
+exported, see below for implications of this).
+Note that both the parameter name and the
.Ql =
-must be unquoted for the shell to recognize a parameter assignment. The fourth
-way of setting a parameter is with the
+must be unquoted for the shell to recognize a parameter assignment.
+The fourth way of setting a parameter is with the
.Ic export ,
.Ic readonly
and
.Ic typeset
commands; see their descriptions in the
.Sx Command execution
-section. Fifth,
+section.
+Fifth,
.Ic for
and
.Ic select
.Ic read
and
.Ic set Fl A
-commands. Lastly, parameters can be assigned values using assignment operators
+commands.
+Lastly, parameters can be assigned values using assignment operators
inside arithmetic expressions (see
.Sx Arithmetic expressions
below) or using the
.Xr environ 5 )
of commands run by the shell as
.Ar name Ns No = Ns Ar value
-pairs. The order in which parameters appear in the environment of a command is
-unspecified. When the shell starts up, it extracts parameters and their values
+pairs.
+The order in which parameters appear in the environment of a command is
+unspecified.
+When the shell starts up, it extracts parameters and their values
from its environment and automatically sets the export attribute for those
parameters.
.Pp
is printed on standard error (preceded by
.Ar name Ns No \&: )
and an error occurs (normally causing termination of a shell script, function
-or .-script). If word is omitted the string
+or .-script).
+If word is omitted the string
.Dq parameter null or not set
is used instead.
.El
.Ar pattern
matches the beginning of the value of parameter
.Ar name ,
-the matched text is deleted from the result of substitution. A single
+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.
set directly using assignments:
.Bl -tag -width "1 ... 9"
.It Ev \&!
-Process ID of the last background process started. If no background processes
-have been started, the parameter is not set.
+Process ID of the last background process started.
+If no background processes have been started, the parameter is not set.
.It Ev \&#
The number of positional parameters (i.e., $1, $2, etc.).
.It Ev \&$
.Ic set
command below for list of options).
.It Ev \&?
-The exit status of the last non-asynchronous command executed. If the last
-command was killed by a signal,
+The exit status of the last non-asynchronous command executed.
+If the last command was killed by a signal,
.Ic \&$\&?
is set to 128 plus the signal number.
.It Ev 0
.Ar command-name
was supplied, or the
.Ar file
-argument, if it was supplied. If the
+argument, if it was supplied.
+If the
.Ic posix
option is not set,
.Ic \&$0
is the name of the current function or script.
.It Ev 1 ... Ev 9
The first nine positional parameters that were supplied to the shell, function
-or .-script. Further positional parameters may be accessed using
+or .-script.
+Further positional parameters may be accessed using
.Ic ${ Ns Ar number Ns Ic \&} .
.It Ev \&*
-All positional parameters (except parameter 0), i.e., $1, $2, $3... If used
+All positional parameters (except parameter 0), i.e., $1, $2, $3...
+If used
outside of double quotes, parameters are separate words (which are subjected
to word splitting); if used within double quotes, parameters are separated
by the first character of the
Same as
.Ic \&$\&* ,
unless it is used inside double quotes, in which case a separate word is
-generated for each positional parameter. If there are no positional parameters,
-no word is generated.
+generated for each positional parameter.
+If there are no positional parameters, no word is generated.
.Ic \&$\&@
can be used to access arguments, verbatim, without losing
.Dv NULL
.Bl -tag -width "EXECSHELL"
.It Ev \&_ No (underscore)
When an external command is executed by the shell, this parameter is set in the
-environment of the new process to the path of the executed command. In
-interactive use, this parameter is also set in the parent shell to the last
-word of the previous command. When
+environment of the new process to the path of the executed command.
+In interactive use, this parameter is also set in the parent shell to the last
+word of the previous command.
+When
.Ev MAILPATH
messages are evaluated, this parameter contains the name of the file that
changed (see
.It Ev CDPATH
Search path for the
.Ic cd
-built-in command. Works the same way as
+built-in command.
+Works the same way as
.Ev PATH
for those directories not beginning with
.Ql /
in
.Ic cd
-commands. Note that if
+commands.
+Note that if
.Ev CDPATH
is set and does not contain
.Dq \&.
-or contains an empty path, the current directory is not searched. Also, the
+or contains an empty path, the current directory is not searched.
+Also, the
.Ic cd
built-in command will display the resulting directory when a match is found
in any search path other than the empty path.
.It Ev COLUMNS
-Set to the number of columns on the terminal or window. Currently set to the
+Set to the number of columns on the terminal or window.
+Currently set to the
.Dq cols
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
+if that value is non-zero.
+This parameter is used by the interactive line editing modes, and by
.Ic select ,
.Ic set Fl o ,
and
If the
.Ev VISUAL
parameter is not set, this parameter controls the command-line editing mode for
-interactive shells. See
+interactive shells.
+See
.Ev VISUAL
parameter below for how this works.
.It Ev ENV
If this parameter is found to be set after any profile files are executed, the
-expanded value is used as a shell startup file. It typically contains function
-and alias definitions.
+expanded value is used as a shell startup file.
+It typically contains function and alias definitions.
.It Ev ERRNO
Integer value of the shell's
.Va errno
-variable. It indicates the reason the last system call failed. Not yet
-implemented.
+variable.
+It indicates the reason the last system call failed.
+Not yet implemented.
.It Ev EXECSHELL
If set, this parameter is assumed to contain the shell that is to be used to
execute commands that
Like
.Ev PATH ,
but used when an undefined function is executed to locate the file defining the
-function. It is also searched when a command can't be found using
+function.
+It is also searched when a command can't be found using
.Ev PATH .
See
.Sx Functions
below for more information.
.It Ev HISTFILE
-The name of the file used to store command history. When assigned to, history
-is loaded from the specified file. Also, several invocations of the shell
+The name of the file used to store command history.
+When assigned to, history is loaded from the specified file.
+Also, several invocations of the shell
running on the same machine will share history if their
.Ev HISTFILE
parameters all point to the same file.
.Sy Note:
If
.Ev HISTFILE
-isn't set, no history file is used. This is different from the original Korn
-shell, which uses
+isn't set, no history file is used.
+This is different from the original Korn shell, which uses
.Pa $HOME/.sh_history ;
in future,
.Nm pdksh
may also use a default history file.
.It Ev HISTSIZE
-The number of commands normally stored for history. The default is 128.
+The number of commands normally stored for history.
+The default is 128.
.It Ev HOME
The default directory for the
.Ic cd
Internal field separator, used during substitution and by the
.Ic read
command, to split values into distinct arguments; normally set to space, tab
-and newline. See
+and newline.
+See
.Sx Substitution
above for details.
.Pp
The line number of the function or shell script that is currently being
executed.
.It Ev LINES
-Set to the number of lines on the terminal or window. Not yet implemented.
+Set to the number of lines on the terminal or window.
+Not yet implemented.
.It Ev MAIL
If set, the user will be informed of the arrival of mail in the named file.
This parameter is ignored if the
.Ev MAIL
or
.Ev MAILPATH .
-If set to 0, the shell checks before each prompt. The default is 600 (10
-minutes).
+If set to 0, the shell checks before each prompt.
+The default is 600 (10 minutes).
.It Ev MAILPATH
-A list of files to be checked for mail. The list is colon separated, and each
-file may be followed by a
+A list of files to be checked for mail.
+The list is colon separated, and each file may be followed by a
.Ql ?
-and a message to be printed if new mail has arrived. Command, parameter and
+and a message to be printed if new mail has arrived.
+Command, parameter and
arithmetic substitution is performed on the message, and, during substitution,
the parameter
.Ev $_
-contains the name of the file. The default message is
+contains the name of the file.
+The default message is
.Dq you have mail in $_ .
.It Ev OLDPWD
-The previous working directory. Unset if
+The previous working directory.
+Unset if
.Ic cd
has not successfully changed directories since the shell started, or if the
shell doesn't know where it is.
to process arguments from the beginning the next time it is invoked.
.It Ev PATH
A colon separated list of directories that are searched when looking for
-commands and .'d files. An empty string resulting from a leading or trailing
+commands and .'d files.
+An empty string resulting from a leading or trailing
colon, or two adjacent colons, is treated as a
.Dq \&. ,
the current directory.
.It Ev POSIXLY_CORRECT
If set, this parameter causes the
.Ic posix
-option to be enabled. See
+option to be enabled.
+See
.Sx POSIX mode
below.
.It Ev PPID
The process ID of the shell's parent (read-only).
.It Ev PS1
-The primary prompt for interactive shells. Parameter, command, and arithmetic
+The primary prompt for interactive shells.
+Parameter, command, and arithmetic
substitutions are performed, and
.Ql !
is replaced with the current command number (see
.Ic fc
-command below). A literal
+command below).
+A literal
.Ql !
can be put in the prompt by placing
.Ql !!
.Ev PS1 .
Note that since the command-line editors try to figure out how long the prompt
is (so they know how far it is to the edge of the screen), escape codes in
-the prompt tend to mess things up. You can tell the shell not to count certain
+the prompt tend to mess things up.
+You can tell the shell not to count certain
sequences (such as escape codes) by prefixing your prompt with a non-printing
character (such as control-A) followed by a carriage return and then delimiting
-the escape codes with this non-printing character. If you don't have any
-non-printing characters, you're out of luck. By the way, don't blame me for
+the escape codes with this non-printing character.
+If you don't have any non-printing characters, you're out of luck.
+By the way, don't blame me for
this hack; it's in the original
.Xr ksh .
Default is
.It Ev PS3
Prompt used by
.Ic select
-statement when reading a menu selection. Default is
+statement when reading a menu selection.
+Default is
.Dq \&#\&?\ \& .
.It Ev PS4
Used to prefix commands that are printed during execution tracing (see
.Ic set Fl x
-command below). Parameter, command, and arithmetic substitutions are performed
-before it is printed. Default is
+command below).
+Parameter, command, and arithmetic substitutions are performed
+before it is printed.
+Default is
.Dq \&+\ \& .
.It Ev PWD
-The current working directory. May be unset or
+The current working directory.
+May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev RANDOM
-A simple random number generator. Every time
+A simple random number generator.
+Every time
.Ev RANDOM
-is referenced, it is assigned the next number in a random number series. The
-point in the series can be set by assigning a number to
+is referenced, it is assigned the next number in a random number series.
+The point in the series can be set by assigning a number to
.Ev RANDOM
(see
.Xr rand 3 ) .
.It Ev REPLY
Default parameter for the
.Ic read
-command if no names are given. Also used in
+command if no names are given.
+Also used in
.Ic select
loops to store the value that is read from standard input.
.It Ev SECONDS
.Pq Ev PS1 .
If the time is exceeded, the shell exits.
.It Ev TMPDIR
-The directory shell temporary files are created in. If this parameter is not
+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
files are created in
.Pa /tmp .
.It Ev VISUAL
If set, this parameter controls the command-line editing mode for interactive
-shells. If the last component of the path specified in this parameter contains
+shells.
+If the last component of the path specified in this parameter contains
the string
.Dq vi ,
.Dq emacs
.Ql ~ .
The characters following the tilde, up to the first
.Ql / ,
-if any, are assumed to be a login name. If the login name is empty,
+if any, are assumed to be a login name.
+If the login name is empty,
.Ql +
or
.Ql - ,
.Ev PWD ,
or
.Ev OLDPWD
-parameter is substituted, respectively. Otherwise, the password file is
+parameter is substituted, respectively.
+Otherwise, the password file is
searched for the login name, and the tilde expression is substituted with the
-user's home directory. If the login name is not found in the password file or
+user's home directory.
+If the login name is not found in the password file or
if any quoting or parameter substitution occurs in the login name, no
substitution is performed.
.Pp
and
.Dq ade ) .
As noted in the example, brace expressions can be nested and the resulting
-words are not sorted. Brace expressions must contain an unquoted comma
+words are not sorted.
+Brace expressions must contain an unquoted comma
.Pq Sq \&,
for expansion to occur (i.e.,
.Ic {}
and
.Ic {foo}
-are not expanded). Brace expansion is carried out after parameter substitution
+are not expanded).
+Brace expansion is carried out after parameter substitution
and before file name generation.
.Ss File name patterns
A file name pattern is a word containing one or more unquoted
.Ql *
characters or
.Dq [..]
-sequences. Once brace expansion has been performed, the shell replaces file
+sequences.
+Once brace expansion has been performed, the shell replaces file
name patterns with the sorted named of all the files that match the pattern
-(if no files match, the word is left unchanged). The pattern elements have the
-following meaning:
+(if no files match, the word is left unchanged).
+The pattern elements have the following meaning:
.Bl -tag -width Ds
.It Ic \&?
Matches any single character.
.It Ic \&*
Matches any sequence of characters.
.It Ic \&[ Ns No .. Ns Ic \&]
-Matches any of the characters inside the brackets. Ranges of characters can be
+Matches any of the characters inside the brackets.
+Ranges of characters can be
specified by separating two characters by a
.Ql -
(e.g.,
.Dq [a0-9]
matches the letter
.Dq a
-or any digit). In order to represent itself, a
+or any digit).
+In order to represent itself, a
.Ql -
must either be quoted or the first or last character in the character list.
Similarly, a
.Ql \&]
must be quoted or the first character in the list if it is to represent itself
-instead of the end of the list. Also, a
+instead of the end of the list.
+Also, a
.Ql !
appearing at the start of the list has special meaning (see below), so to
represent itself it must be quoted or appear later in the list.
.Xc
.Sm on
Matches any string of characters that matches zero or more occurrences of the
-specified patterns. Example: The pattern
+specified patterns.
+Example: The pattern
.Ic \&*(foo\&|bar)
matches the strings
.Dq ,
.Xc
.Sm on
Matches any string of characters that matches one or more occurrences of the
-specified patterns. Example: The pattern
+specified patterns.
+Example: The pattern
.Ic \&+(foo\&|bar)
matches the strings
.Dq foo ,
.Xc
.Sm on
Matches the empty string or a string that matches one of the specified
-patterns. Example: The pattern
+patterns.
+Example: The pattern
.Ic \&?(foo\&|bar)
only matches the strings
.Dq ,
.Ic \&| Ar pattern Ic \&)
.Xc
.Sm on
-Matches a string that matches one of the specified patterns. Example: The
-pattern
+Matches a string that matches one of the specified patterns.
+Example: The pattern
.Ic \&@(foo\&|bar)
only matches the strings
.Dq foo
.Ic \&| Ar pattern Ic \&)
.Xc
.Sm on
-Matches any string that does not match one of the specified patterns. Examples:
-The pattern
+Matches any string that does not match one of the specified patterns.
+Examples: The pattern
.Ic \&!(foo\&|bar)
matches all strings except
.Dq foo
.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
-the shell. Three exceptions to this are commands in pipelines, for which
+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,
asynchronous commands created when job control is disabled, for which standard
input is initially set to be from
.Ar file
does not exist, it is created; if it does exist, is a regular file and the
.Ic noclobber
-option is set, an error occurs; otherwise, the file is truncated. Note that
-this means the command
+option is set, an error occurs; otherwise, the file is truncated.
+Note that this means the command
.Ic cmd < foo > foo
will open
.Ar foo
.Ic \&> ,
except if
.Ar file
-exists it is appended to instead of being truncated. Also, the file is opened
+exists it is appended to instead of being truncated.
+Also, the file is opened
in append mode, so writes always go to the end of the file (see
.Fn open 2 ) .
.It Ic \&< Ar file
the shell copies lines from the command source into a temporary file until a
line matching
.Ar marker
-is read. When the command is executed, standard input is redirected from the
-temporary file. If
+is read.
+When the command is executed, standard input is redirected from the
+temporary file.
+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
.Pp
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
+redirection with a single digit.
+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
and
.Ar fd
-arguments of redirections. Note, however, that the results of any file name
+arguments of redirections.
+Note, however, that the results of any file name
generation are only used if a single file is matched; if multiple files match,
-the word with the expanded file name generation characters is used. Note
+the word with the expanded file name generation characters is used.
+Note
that in restricted shells, redirections which can create files cannot be used.
.Pp
For simple-commands, redirections may appear anywhere in the command; for
.Ic if
statements, etc.
.Pc ,
-any redirections must appear at the end. Redirections are processed after
+any redirections must appear at the end.
+Redirections are processed after
pipelines are created and in the order they are given, so
.Pp
.Ic cat /foo/bar 2\&>&1 \&> /dev/null \&| cat -n
.Tn NOT .
.It Ic \&+\&+
Increment; must be applied to a parameter (not a literal or other expression).
-The parameter is incremented by 1. When used as a prefix operator, the result
+The parameter is incremented by 1.
+When used as a prefix operator, the result
is the incremented value of the parameter; when used as a postfix operator, the
result is the original value of the parameter.
.It Ic \&-\&-
except the parameter is decremented by 1.
.It Ic \&,
Separates two arithmetic expressions; the left-hand side is evaluated first,
-then the right. The result is the value of the expression on the right-hand
-side.
+then the right.
+The result is the value of the expression on the right-hand side.
.It Ic =
Assignment; variable on the left is set to the value on the right.
.It Xo Ic \&*= /= \&+= \&-= \&<\&<=
.It Ic \&|\&|
Logical
.Tn OR ;
-the result is 1 if either argument is non-zero, 0 if not. The right
-argument is evaluated only if the left argument is zero.
+the result is 1 if either argument is non-zero, 0 if not.
+The right argument is evaluated only if the left argument is zero.
.It Ic \&&\&&
Logical
.Tn AND ;
-the result is 1 if both arguments are non-zero, 0 if not. The
-right argument is evaluated only if the left argument is non-zero.
+the result is 1 if both arguments are non-zero, 0 if not.
+The right argument is evaluated only if the left argument is non-zero.
.It Ic \&|
Arithmetic (bit-wise)
.Tn OR .
Less than; the result is 1 if the left argument is less than the right, 0 if
not.
.It Ic \&<= \&>= \&>
-Less than or equal, greater than or equal, greater than. See
+Less than or equal, greater than or equal, greater than.
+See
.Ic \&< .
.It Ic \&<\&< \&>\&>
Shift left (right); the result is the left argument with its bits shifted left
Addition, subtraction, multiplication, and division.
.It Ic %
Remainder; the result is the remainder of the division of the left argument by
-the right. The sign of the result is unspecified if either argument is
-negative.
+the right.
+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
.Ic \&>\&&p
and
.Ic \&<\&&p
-redirections, respectively. Once a co-process has been started, another can't
+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
redirected using an
.Ic exec Ar n Ns Ic \&>\&&p
-redirection. If a co-process's input is redirected in this way, the next
+redirection.
+If a co-process's input is redirected in this way, the next
co-process to be started will share the output with the first co-process,
unless the output of the initial co-process has been redirected using an
.Ic exec Ar n Ns Ic \&<\&&p
.Ic exec 3\&>\&&p\&; exec 3>\&>\&&\&- ) .
.It
In order for co-processes to share a common output, the shell must keep the
-write portion of the output pipe open. This means that end-of-file will not be
+write portion of the output pipe open.
+This means that end-of-file will not be
detected until all co-processes sharing the co-process output have exited
-(when they all exit, the shell closes its copy of the pipe). This can be
+(when they all exit, the shell closes its copy of the pipe).
+This can be
avoided by redirecting the output to a numbered file descriptor (as this also
-causes the shell to close its copy). Note that this behaviour is slightly
+causes the shell to close its copy).
+Note that this behaviour is slightly
different from the original Korn shell which closes its copy of the write
portion of the co-process output when the most recently started co-process
(instead of when all sharing co-processes) exits.
.Ic function Ar name
syntax or the Bourne/POSIX shell
.Fn name
-syntax (see below for the difference between the two forms). Functions are like
+syntax (see below for the difference between the two forms).
+Functions are like
.Li .-scripts
-in that they are executed in the current environment. However, unlike
+in that they are executed in the current environment.
+However, unlike
.Li .-scripts ,
shell arguments (i.e., positional parameters $1, $2, etc.) are never visible
-inside them. When the shell is determining the location of a command, functions
+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
.Ev PATH
executed, the shell searches the path specified in the
.Ev FPATH
parameter for a file with the same name as the function, which, if found, is
-read and executed. If after executing the file the named function is found to
+read and executed.
+If after executing the file the named function is found to
be defined, the function is executed; otherwise, the normal command search is
continued (i.e., the shell searches the regular built-in command table and
.Ev PATH ) .
.Ic typeset \&-ft
and
.Ic typeset \&-fx ,
-respectively. When a traced function is executed, the shell's
+respectively.
+When a traced function is executed, the shell's
.Ic xtrace
option is turned on for the function's duration; otherwise, the
.Ic xtrace
-option is turned off. The
+option is turned off.
+The
.Dq export
-attribute of functions is currently not used. In the original Korn shell,
+attribute of functions is currently not used.
+In the original Korn shell,
exported functions are visible to shell scripts that are executed.
.Pp
Since functions are executed in the current shell environment, parameter
assignments made inside functions are visible after the function completes.
If this is not the desired effect, the
.Ic typeset
-command can be used inside a function to create a local parameter. Note that
-special parameters (e.g., $$, $\&!) can't be scoped in this way.
+command can be used inside a function to create a local parameter.
+Note that special parameters (e.g., $$, $\&!) can't be scoped in this way.
.Pp
The exit status of a function is that of the last command executed in the
-function. A function can be made to finish immediately using the
+function.
+A function can be made to finish immediately using the
.Ic return
command; this may also be used to explicitly specify the exit status.
.Pp
.Ic getopts
inside a function interferes with using
.Ic getopts
-outside the function). In the future, the following differences will also be
-added:
+outside the function).
+In the future, the following differences will also be added:
.Bl -bullet -offset indent
.It
A separate trap/signal environment will be used during the execution of
-functions. This will mean that traps set inside a function will not affect the
+functions.
+This will mean that traps set inside a function will not affect the
shell's traps and signals that are not ignored in the shell (but may be
trapped) will have their default effect in a function.
.It
compliant; however, in some cases,
.Tn POSIX
behaviour is contrary either to the original Korn shell behaviour or to user
-convenience. How the shell behaves in these cases is determined by the state
-of the
+convenience.
+How the shell behaves in these cases is determined by the state of the
.Ic posix
option
.Pq Ic set Fl o Ic posix .
If it is on, the
.Tn POSIX
-behaviour is followed; otherwise, it is not. The
+behaviour is followed; otherwise, it is not.
+The
.Ic posix
option is set automatically when the shell starts up if the environment
contains the
.Dv POSIXLY_CORRECT
parameter. (The shell can also be compiled so that it is in
.Tn POSIX
-mode by
-default; however, this is usually not desirable).
+mode by default; however, this is usually not desirable).
.Pp
The following is a list of things that are affected by the state of the
.Ic posix
.Ic \e\&"
inside double quoted
.Ic `\&.\&.`
-command substitutions. In
+command substitutions.
+In
.Tn POSIX
mode, the
.Ic \e\&"
is interpreted when the command is interpreted; in
.Pf non- Tn POSIX
mode, the
-backslash is stripped before the command substitution is interpreted. For
-example,
+backslash is stripped before the command substitution is interpreted.
+For example,
.Ic echo \&"`echo \e\&"hi\e\&"`\&"
produces
.Dq \&"hi\&"
.Dq hi
in
.Pf non- Tn POSIX
-mode. To avoid problems, use the
+mode.
+To avoid problems, use the
.Ic $(...)
form of command substitution.
.It
.Ic kill -l
-output. In
+output.
+In
.Tn POSIX
mode, signal names are listed one per line; in
.Pf non- Tn POSIX
mode,
-signal numbers, names and descriptions are printed in columns. In future, a new
-option
+signal numbers, names and descriptions are printed in columns.
+In future, a new option
.Po Fl v
\ perhaps
.Pc
will be added to distinguish the two behaviours.
.It
.Ic fg
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status is 0 if no errors occur; in
.Pf non- Tn POSIX
mode, the exit status is that of the last foregrounded job.
.It
.Ic eval
-exit status. If
+exit status.
+If
.Ic eval
gets to see an empty command (i.e.,
.Ic eval "`false`" ) ,
its exit status in
.Tn POSIX
-mode will be 0. In
+mode will be 0.
+In
.Pf non- Tn POSIX
mode, it will be the exit status of the last command substitution that was
done in the processing of the arguments to
or
.Ql + .
.It
-Brace expansion (also known as alternation). In
+Brace expansion (also known as alternation).
+In
.Tn POSIX
mode, brace expansion is
disabled; in
.Pf non- Tn POSIX
-mode, brace expansion is enabled. Note that
+mode, brace expansion is enabled.
+Note that
.Ic set Fl o Ic posix
(or setting the
.Ev POSIXLY_CORRECT
mode, it does.
.It
.Ic set
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status of
.Ic set
mode, the exit status is that of any
command substitutions performed in generating the
.Ic set
-command. For example,
+command.
+For example,
.Ic set \&-\&- `false`; echo $?
prints 0 in
.Tn POSIX
mode, 1 in
.Pf non- Tn POSIX
-mode. This construct is used in most
-shell scripts that use the old
+mode.
+This construct is used in most shell scripts that use the old
.Xr getopt 1
command.
.It
.Ic readonly ,
and
.Ic typeset
-commands. In
+commands.
+In
.Tn POSIX
mode, normal argument expansion is done; in
.Pf non- Tn POSIX
field splitting, file globbing, brace expansion, and (normal) tilde expansion
are turned off, while assignment tilde expansion is turned on.
.It
-Signal specification. In
+Signal specification.
+In
.Tn POSIX
mode, signals can be specified as digits, only
if signal numbers match
.Pf non- Tn POSIX
mode, signals can always be digits.
.It
-Alias expansion. In
+Alias expansion.
+In
.Tn POSIX
mode, alias expansion is only carried out when
reading command words; in
.Pf non- Tn POSIX
mode, alias expansion is carried out on any
-word following an alias that ended in a space. For example, the following
+word following an alias that ended in a space.
+For example, the following
.Ic for
loop
.Pp
.Pf non- Tn POSIX
mode.
.It
-Test. In
+Test.
+In
.Tn POSIX
mode, the expression
.Dq Fl t
.Dq Ic \&!
arguments) is always true as it is a non-zero length string; in
.Pf non- Tn POSIX
-mode,
-it tests if file descriptor 1 is a tty (i.e., the
+mode, it tests if file descriptor 1 is a tty (i.e., the
.Ar fd
argument to the
.Fl t
.El
.Ss Command execution
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
.Ev PATH
-parameter. The checks are made in the above order. Special built-in commands
-differ from other commands in that the
+parameter.
+The checks are made in the above order.
+Special built-in commands differ from other commands in that the
.Ev PATH
parameter is not used to find them, and an error during their execution can
cause a non-interactive shell to exit and parameter assignments that are
-specified before the command are kept after the command completes. Just to
-confuse things, if the
+specified before the command are kept after the command completes.
+Just to confuse things, if the
.Ic posix
option is turned off (see
.Ic set
command below), some special commands are very special in that no field
splitting, file globbing, brace expansion, nor tilde expansion is performed
-on arguments that look like assignments. Regular built-in commands are
-different only in that the
+on arguments that look like assignments.
+Regular built-in commands are different only in that the
.Ev PATH
parameter is not used to find them.
.Pp
The original
-.Nm
+.Nm ksh
and
.Tn POSIX
differ somewhat in which commands are considered
.It Ic \&. Ar file Op Ar arg1 ...
Execute the commands in
.Ar file
-in the current environment. The file is searched for in the directories of
+in the current environment.
+The file is searched for in the directories of
.Ev PATH .
If arguments are given, the positional parameters may be used to access them
while
.Ar file
-is being executed. If no arguments are given, the positional parameters are
+is being executed.
+If no arguments are given, the positional parameters are
those of the environment the command is used in.
.It Ic \&: Op Ar ...
-The null command. Exit status is set to zero.
+The null command.
+Exit status is set to zero.
.It Xo Ic alias
.Op Fl d | Ic +-t Op Fl r
.Op Ic +-px
.Xc
Without arguments,
.Ic alias
-lists all aliases. For any name without a value, the existing alias is listed.
+lists all aliases.
+For any name without a value, the existing alias is listed.
Any name with a value defines an alias (see
.Sx Aliases
above).
.Pp
-When listing aliases, one of two formats is used. Normally, aliases are listed
-as
+When listing aliases, one of two formats is used.
+Normally, aliases are listed as
.Ar name Ns No = Ar value ,
where
.Ar value
-is quoted. If options were preceded with
+is quoted.
+If options were preceded with
.Ql + ,
or a lone
.Ql +
is given on the command line, only
.Ar name
-is printed. In addition, if the
+is printed.
+In addition, if the
.Fl p
option is used, each alias is prefixed with the string
.Dq alias\ \& .
The
.Fl t
option indicates that tracked aliases are to be listed/set (values specified on
-the command line are ignored for tracked aliases). The
+the command line are ignored for tracked aliases).
+The
.Fl r
option indicates that all tracked aliases are to be reset.
.Pp
.Sx Tilde expansion
above).
.It Ic bg Op Ar job ...
-Resume the specified stopped job(s) in the background. If no jobs are
-specified,
+Resume the specified stopped job(s) in the background.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+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
.Ar dir .
A
.Dv NULL
-path means the current directory. If
+path means the current directory.
+If
.Ar dir
is found in any component of the
.Ev CDPATH
.Ar dir
is missing, the home directory
.Ev HOME
-is used. If
+is used.
+If
.Ar dir
is
.Dq - ,
the previous working directory is used (see
.Ev OLDPWD
-parameter). If the
+parameter).
+If the
.Fl L
option (logical path) is used or if the
.Ic physical
.Dq \&.\&.
in
.Ar dir
-are relative to the path used to get to the directory. If the
+are relative to the path used to get to the directory.
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
option is set,
.Dq \&.\&.
-is relative to the filesystem directory tree. The
+is relative to the filesystem directory tree.
+The
.Ev PWD
and
.Ev OLDPWD
.Ar cmd
is executed exactly as if the
.Ic command
-had not been specified, with two exceptions. First,
+had not been specified, with two exceptions.
+First,
.Ar cmd
cannot be a shell function, and second, special built-in commands lose their
specialness (i.e., redirection and utility errors do not cause the shell to
-exit, and command assignments are not permanent). If the
+exit, and command assignments are not permanent).
+If the
.Fl p
option is given, a default search path is used instead of the current value of
.Ev PATH
printed; for aliases, a command that defines them is printed; and for commands
found by searching the
.Ev PATH
-parameter, the full path of the command is printed. If no command is found
+parameter, the full path of the command is printed.
+If no command is found
(i.e., the path search fails), nothing is printed and
.Ic command
-exits with a non-zero status. The
+exits with a non-zero status.
+The
.Fl V
option is like the
.Fl v
.Op Ar arg ...
.Xc
Prints its arguments (separated by spaces) followed by a newline, to the
-standard output. The newline is suppressed if any of the arguments contain the
+standard output.
+The newline is suppressed if any of the arguments contain the
backslash sequence
.Ql \ec .
See the
.Pp
The options are provided for compatibility with
.Bx
-shell scripts. The
+shell scripts.
+The
.Fl n
option suppresses the trailing newline,
.Fl e
.Pp
If no command is given except for I/O redirection, the I/O redirection is
permanent and the shell is
-not replaced. Any file descriptors greater than 2 which are opened or
+not replaced.
+Any file descriptors greater than 2 which are opened or
.Xr dup 2 Ns 'd
in this way are not made available to other executed commands (i.e., commands
-that are not built-in to the shell). Note that the Bourne shell differs here;
+that are not built-in to the shell).
+Note that the Bourne shell differs here;
it does pass these file descriptors on.
.It Ic exit Op Ar status
-The shell exits with the specified exit status. If
+The shell exits with the specified exit status.
+If
.Ar status
is not specified, the exit status is the current value of the
.Ic \&?
.It Xo Ic export Op Fl p
.Op Ar parameter Ns Op \&= Ns Ar value
.Xc
-Sets the export attribute of the named parameters. Exported parameters are
-passed in the environment to executed commands. If values are specified, the
-named parameters are also assigned.
+Sets the export attribute of the named parameters.
+Exported parameters are passed in the environment to executed commands.
+If values are specified, the named parameters are also assigned.
.Pp
If no parameters are specified, the names of all parameters with the export
attribute are printed one per line, unless the
.Ar first
and
.Ar last
-select commands from the history. Commands can be selected by history number
-or a string specifying the most recent command starting with that string. The
+select commands from the history.
+Commands can be selected by history number
+or a string specifying the most recent command starting with that string.
+The
.Fl l
option lists the command on stdout, and
.Fl n
-inhibits the default command numbers. The
+inhibits the default command numbers.
+The
.Fl r
-option reverses the order of the list. Without
+option reverses the order of the list.
+Without
.Fl l ,
the selected commands are edited by the editor specified with the
.Fl e
This command is usually accessed with the predefined
.Ic alias r='fx -e -' .
.It Ic fg Op Ar job ...
-Resume the specified job(s) in the foreground. If no jobs are specified,
+Resume the specified job(s) in the foreground.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+is assumed.
+This command is only available on systems which support job control (see
.Sx Job control
below for more information).
.It Xo Ic getopts Ar optstring name
.Ar optstring
contains the option letters that
.Ic getopts
-is to recognize. If a letter is followed by a colon, the option is expected to
-have an argument. Options that do not take arguments may be grouped in a single
-argument. If an option takes an argument and the option character is not the
+is to recognize.
+If a letter is followed by a colon, the option is expected to
+have an argument.
+Options that do not take arguments may be grouped in a single argument.
+If an option takes an argument and the option character is not the
last character of the argument it is found in, the remainder of the argument is
taken to be the option's argument; otherwise, the next argument is the option's
argument.
.Ar name
(indicating an illegal option or missing argument, respectively) and
.Ev OPTAG
-is set to the option character that caused the problem. An error message is
-also printed to standard error if
+is set to the option character that caused the problem.
+An error message is also printed to standard error if
.Ar optstring
does not being with a colon.
.Pp
When the end of the options is encountered,
.Ic getopts
-exits with a non-zero exit status. Options end at the first (non-option
+exits with a non-zero exit status.
+Options end at the first (non-option
argument) argument that does not start with a
.Ql - ,
or when a
.It Xo Ic hash Op Fl r
.Op Ar name ...
.Xc
-Without arguments, any hashed executable command pathnames are listed. The
+Without arguments, any hashed executable command pathnames are listed.
+The
.Fl r
-option causes all hashed commands to be removed from the hash table. Each
+option causes all hashed commands to be removed from the hash table.
+Each
.Ar name
is searched as if it were a command name and added to the hash table if it is
an executable command.
.Op Ar job ...
.Xc
Display information about the specified job(s); if no jobs are specified, all
-jobs are displayed. The
+jobs are displayed.
+The
.Fl n
option causes information to be displayed only for jobs that have changed
-state since the last notification. If the
+state since the last notification.
+If the
.Fl l
-option is used, the process ID of each process in a job is also listed. The
+option is used, the process ID of each process in a job is also listed.
+The
.Fl p
-option causes only the process group of each job to be printed. See
+option causes only the process group of each job to be printed.
+See
.Sx Job control
below for the format of
.Ar job
.Ar pgrp No } Ar ...
.Xc
Send the specified signal to the specified jobs, process IDs, or process
-groups. If no signal is specified, the
+groups.
+If no signal is specified, the
.Dv TERM
-signal is sent. If a job is specified, the signal is sent to the job's
-process group. See
+signal is sent.
+If a job is specified, the signal is sent to the job's process group.
+See
.Sx Job control
below for the format of
.Ar job .
.It Ic let Op Ar expression ...
Each expression is evaluated (see
.Sx Arithmetic expressions
-above). If all expressions are successfully evaluated, the exit status is 0 (1)
-if the last expression evaluated to non-zero (zero). If an error occurs during
+above).
+If all expressions are successfully evaluated, the exit status is 0 (1)
+if the last expression evaluated to non-zero (zero).
+If an error occurs during
the parsing or evaluation of an expression, the exit status is greater than 1.
Since expressions may need to be quoted,
.Ic (( Ar expr Ic ))
.Xc
.Ic print
prints its arguments on the standard output, separated by spaces and
-terminated with a newline. The
+terminated with a newline.
+The
.Fl n
-option suppresses the newline. By default, certain C escapes are translated.
+option suppresses the newline.
+By default, certain C escapes are translated.
These include
.Ql \eb ,
.Ql \ef ,
.Ql \e
expansion may be inhibited with the
.Fl r
-option. The
+option.
+The
.Fl s
option prints to the history file instead of standard output, the
.Fl u
.Ql \e
sequences unless the
.Fl e
-option is given. As above, the
+option is given.
+As above, the
.Fl n
option suppresses the trailing newline.
.It Ic pwd Op Fl LP
-Print the present working directory. If the
+Print the present working directory.
+If the
.Fl L
option is used or if the
.Ic physical
.Ic set
command below) isn't set, the logical path is printed (i.e., the path used to
.Ic cd
-to the current directory). If the
+to the current directory).
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
.Ev IFS
parameter (see
.Sx Substitution
-above), and assigns each field to the specified parameters. If there are more
-parameters than fields, the extra parameters are set to
+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
-is assigned the remaining fields (inclusive of any separating spaces). If no
-parameters are specified, the
+is assigned the remaining fields (inclusive of any separating spaces).
+If no parameters are specified, the
.Ev REPLY
-parameter is used. If the input line ends in a backslash and the
+parameter is used.
+If the input line ends in a backslash and the
.Fl r
option was not used, the backslash and the newline are stripped and more input
-is read. If no input is read,
+is read.
+If no input is read,
.Ic read
exits with a non-zero status.
.Pp
.Ar n
or the current co-process (see
.Sx Co-processes
-above for comments on this), respectively. If the
+above for comments on this), respectively.
+If the
.Fl s
option is used, input is saved to the history file.
.It Xo Ic readonly Op Fl p
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Sets the read-only attribute of the named parameters. If values are given,
-parameters are set to them before setting the attribute. Once a parameter is
+Sets the read-only attribute of the named parameters.
+If values are given,
+parameters are set to them before setting the attribute.
+Once a parameter is
made read-only, it cannot be unset and its value cannot be changed.
.Pp
If no parameters are specified, the names of all parameters with the read-only
.Ar status .
If no
.Ar status
-is given, the exit status of the last executed command is used. If used
-outside of a function or
+is given, the exit status of the last executed command is used.
+If used outside of a function or
.Ic \&.
script, it has the same effect as
.Ic exit .
All new parameters are created with the export attribute.
.It Fl b Ic notify
Print job notification messages asynchronously, instead of just before the
-prompt. Only used if job control is enabled
+prompt.
+Only used if job control is enabled
.Pq Fl m .
.It Fl C Ic noclobber
Prevent
Exit (after executing the
.Dv ERR
trap) as soon as an error occurs or a command fails (i.e., exits with a
-non-zero status). This does not apply to commands whose exit status is
+non-zero status).
+This does not apply to commands whose exit status is
explicitly tested by a shell construct such as
.Ic if ,
.Ic until ,
.It Fl h Ic trackall
Create tracked aliases for all executed commands (see
.Sx Aliases
-above). Enabled by default for non-interactive shells.
+above).
+Enabled by default for non-interactive shells.
.It Fl i Ic interactive
-Enable interactive mode. This can only be set/unset when the shell is invoked.
+Enable interactive mode.
+This can only be set/unset when the shell is invoked.
.It Fl k Ic keyword
Parameter assignments are recognized anywhere in a command.
.It Fl l Ic login
-The shell is a login shell. This can only be set/unset when the shell is
+The shell is a login shell.
+This can only be set/unset when the shell is
invoked (see
.Sx Shell startup
above).
.It Fl m Ic monitor
Enable job control (default for interactive shells).
.It Fl n lc noexec
-Do not execute any commands. Useful for checking the syntax of scripts
+Do not execute any commands.
+Useful for checking the syntax of scripts
(ignored if interactive).
.It Fl p Ic privileged
Set automatically if, when the shell starts, the read UID or GID does not match
-the effective UID (EUID) or GID (EGID), respectively. See
+the effective UID (EUID) or GID (EGID), respectively.
+See
.Sx Shell startup
above for a description of what this means.
.It Fl r Ic restricted
-Enable restricted mode. This option can only be used when the shell is invoked.
+Enable restricted mode.
+This option can only be used when the shell is invoked.
See
.Sx Shell startup
above for a description of what this means.
.It Fl s Ic stdin
-If used where the shell is invoked, commands are read from standard input. Set
-automatically if the shell is invoked with no arguments.
+If used where the shell is invoked, commands are read from standard input.
+Set automatically if the shell is invoked with no arguments.
.Pp
When
.Fl s
Enable BRL emacs-like command-line editing (interactive shells only); see
.Sx Emacs editing mode.
.It Ic gmacs
-Enable gmacs-like command-line editing (interactive shells only). Currently
-identical to emacs editing except that transpose (^T) acts slightly
+Enable gmacs-like command-line editing (interactive shells only).
+Currently identical to emacs editing except that transpose (^T) acts slightly
differently.
.It Ic ignoreeof
The shell will not (easily) exit when end-of-file is read;
.It Ic nohup
Do not kill running jobs with a
.Dv HUP
-signal when a login shell exists. Currently set by default, but this will
+signal when a login shell exists.
+Currently set by default, but this will
change in the future to be compatible with the original Korn shell (which
doesn't have this option, but does send the
.Dv HUP
signal).
.It Ic nolog
-No effect. In the original Korn shell, this prevents function definitions from
+No effect.
+In the original Korn shell, this prevents function definitions from
being stored in the history file.
.It Ic physical
Causes the
.Dq logical
directories (i.e., the shell handles
.Dq \&.\&. ,
-which allows the user to be oblivious of symbolic links to directories). Clear
-by default. Note that setting this option does not affect the current value of
-the
+which allows the user to be oblivious of symbolic links to directories).
+Clear by default.
+Note that setting this option does not affect the current value of the
.Ev PWD
parameter; only the
.Ic cd
.It Ic posix
Enable
.Tn POSIX
-mode. See
+mode.
+See
.Sx POSIX mode
above.
.It Ic vi
Enable vi-like command-line editing (interactive shells only).
.It Ic viraw
-No effect. In the original Korn shell, unless
+No effect.
+In the original Korn shell, unless
.Ic viraw
was set, the vi command-line mode would let the tty driver do the work until
.Tn ESC
which may cause problems.
.It Ic vi-tabcomplete
In vi command-line editing, do command and file name completion when tab (^I)
-is entered in insert mode. This is the default.
+is entered in insert mode.
+This is the default.
.El
.Pp
-These options can also be used upon invocation of the shell. The current set of
+These options can also be used upon invocation of the shell.
+The current set of
options (with single letter names) can be found in the parameter
.Dv \&- .
.Ic set Fl o
will print the long names of all options that are currently on.
.Pp
Remaining arguments, if any, are positional parameters and are assigned, in
-order, to the positional parameters (i.e., $1, $2, etc.). If options end with
+order, to the positional parameters (i.e., $1, $2, etc.).
+If options end with
.Ql --
-and there are no remaining arguments, all positional parameters are cleared. If
-no options or arguments are given, the values of all names are printed. For
-unknown historical reasons, a lone
+and there are no remaining arguments, all positional parameters are cleared.
+If no options or arguments are given, the values of all names are printed.
+For unknown historical reasons, a lone
.Ql -
option is treated specially -- it clears both the
.Fl x
evaluates the
.Ar expression
and returns zero status if true, 1 status if false, or greater than 1 if there
-was an error. It is normally used as the condition command of
+was an error.
+It is normally used as the condition command of
.Ic if
and
.Ic while
-statements. The following basic expressions are available:
+statements.
+The following basic expressions are available:
.Bl -tag -width 17n
.It Ar str
.Ar str
-has non-zero length. Note that there is the potential for problems if
+has non-zero length.
+Note that there is the potential for problems if
.Ar str
turns out to be an operator (e.g.,
.Fl r ) .
.Ar option
is set (see
.Ic set
-command above for a list of options). As a non-standard extension, if the
-option starts with a
+command above for a list of options).
+As a non-standard extension, if the option starts with a
.Ql ! ,
the test is negated; the test always fails if
.Ar option
.It Fl t Op Ar fd
File descriptor
.Ar fd
-is a tty device. If the
+is a tty device.
+If the
.Ic posix
option is not set,
.Ar fd
.Ic test
command will attempt to fake it for all tests that operate on files (except the
.Fl e
-test). For example,
+test).
+For example,
.Ic \&[ -w /dev/fd/2 \&]
tests if file descriptor 2 is writable.
.Pp
.Xc
If a
.Ar pipeline
-is given, the times used to execute the pipeline are reported. If no 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.
The times reported are the real time (elapsed time from start to finish),
.Dl user 0.00
.Dl sys 0.00
.Pp
-(the number of digits after the decimal may vary from system to system). Note
+(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
command:
.Pp
.Dv ALRM )
or the number of the signal (see
.Ic kill -l
-command above). There are two special signals:
+command above).
+There are two special signals:
.Dv EXIT
(also known as 0), which is executed when the shell is about to exit, and
.Dv ERR ,
.Ic set
command above).
.Dv EXIT
-handlers are executed in the environment of the last executed command. Note
+handlers are executed in the environment of the last executed command.
+Note
that for non-interactive shells, the trap handler cannot be changed for signals
that were ignored when the shell started.
.Pp
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Display or set parameter attributes. With no
+Display or set parameter attributes.
+With no
.Ar name
arguments, parameter attributes are displayed; if no options are used, the
current attributes of all parameters are printed as
.Pq Ic \&-
or cleared
.Pq Ic \&+ .
-Values for parameters may optionally be specified. If
+Values for parameters may optionally be specified.
+If
.Ic typeset
is used inside a function, any newly created parameters are local to the
function.
.Fl f
is used,
.Ic typeset
-operates on the attributes of functions. As with parameters, if no
+operates on the attributes of functions.
+As with parameters, if no
.Ar name Ns s
are given, functions are listed with their values (i.e., definitions) unless
options are introduced with
.It Fl L Ns Ar n
Left justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Leading whitespace (and zeros, if used with the
+assigned value) is used.
+Leading whitespace (and zeros, if used with the
.Fl Z
-option) is stripped. If necessary, values are either truncated or space padded
+option) is stripped.
+If necessary, values are either truncated or space padded
to fit the field width.
.It Fl R Ns Ar n
Right justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Trailing whitespace is stripped. If necessary, values
+assigned value) is used.
+Trailing whitespace is stripped.
+If necessary, values
are either stripped of leading characters or space padded to make them fit the
field width.
.It Fl Z Ns Ar n
-Zero fill attribute. If not combined with
+Zero fill attribute.
+If not combined with
.Fl L ,
this is the same as
.Fl R ,
Integer attribute.
.Ar n
specifies the base to use when displaying the integer (if not specified, the
-base given in the first assignment is used). Parameters with this attribute may
+base given in the first assignment is used).
+Parameters with this attribute may
be assigned values containing arithmetic expressions.
.It Fl U
-Unsigned integer attribute. Integers are printed as unsigned values (only
+Unsigned integer attribute.
+Integers are printed as unsigned values (only
useful when combined with the
.Fl i
-option). This option is not in the original Korn shell.
+option).
+This option is not in the original Korn shell.
.It Fl f
-Function mode. Display or set functions and their attributes, instead of
-parameters.
+Function mode.
+Display or set functions and their attributes, instead of parameters.
.It Fl l
-Lower case attribute. All upper case characters in values are converted to
-lower case. (In the original Korn shell, this parameter meant
+Lower case attribute.
+All upper case characters in values are converted to lower case.
+(In the original Korn shell, this parameter meant
.Dq long integer
when used with the
.Fl i
Print complete
.Ic typeset
commands that can be used to re-create the attributes (but not the values) or
-parameters. This is the default action (option exists for ksh93 compatibility).
+parameters.
+This is the default action (option exists for ksh93 compatibility).
.It Fl r
-Read-only attribute. Parameters with this attribute may not be assigned to or
-unset. Once this attribute is set, it can not be turned off.
+Read-only attribute.
+Parameters with this attribute may not be assigned to or unset.
+Once this attribute is set, it can not be turned off.
.It Fl t
-Tag attribute. Has no meaning to the shell; provided for application use.
+Tag attribute.
+Has no meaning to the shell; provided for application use.
.Pp
For functions,
.Fl t
-is the trace attribute. When functions with the trace attribute are executed,
-the
+is the trace attribute.
+When functions with the trace attribute are executed, the
.Ic xtrace
.Pq Fl x
shell option is temporarily turned on.
.It Fl u
-Upper case attribute. All lower case characters in values are converted to
-upper case. (In the original Korn shell, this parameter meant
+Upper case attribute.
+All lower case characters in values are converted to upper case.
+(In the original Korn shell, this parameter meant
.Dq unsigned integer
when used with the
.Fl i
option, which meant upper case letters would never be used for bases greater
-than 10. See the
+than 10.
+See the
.Fl U
option.)
.Pp
For functions,
.Fl u
-is the undefined attribute. See
+is the undefined attribute.
+See
.Sx Functions
above for the implications of this.
.It Fl x
-Export attribute. Parameters (or functions) are placed in the environment of
-any executed commands. Exported functions are not yet implemented.
+Export attribute.
+Parameters (or functions) are placed in the environment of
+any executed commands.
+Exported functions are not yet implemented.
.El
.It Xo Ic ulimit Op Fl acdfHlmnpsStvw
.Op Ar value
.Xc
-Display or set process limits. If no options are used, the file size limit
+Display or set process limits.
+If no options are used, the file size limit
.Pq Fl f
is assumed.
.Ar value ,
if specified, may be either an arithmetic expression or the word
.Dq unlimited .
The limits affect the shell and any processes created by the shell after a
-limit is imposed. Note that some systems may not allow limits to be increased
-once they are set. Also note that the types of limits available are system
+limit is imposed.
+Note that some systems may not allow limits to be increased
+once they are set.
+Also note that the types of limits available are system
dependent -- some systems have only the
.Fl f
limit.
.It Xo Ic unalias Op Fl adt
.Op Ar name1 ...
.Xc
-The aliases for the given names are removed. If the
+The aliases for the given names are removed.
+If the
.Fl a
-option is used, all aliases are removed. If the
+option is used, all aliases are removed.
+If the
.Fl t
or
.Fl d
The exit status is non-zero if any of the parameters were already unset, zero
otherwise.
.It Ic wait Op Ar job ...
-Wait for the specified job(s) to finish. The exit status of
+Wait for the specified job(s) to finish.
+The exit status of
.Ic wait
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
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. See
+is 127.
+See
.Sx Job control
below for the format of
.Ar job .
If no jobs are specified,
.Ic wait
waits for all currently running jobs (if any) to finish and exits with a zero
-status. If job monitoring is enabled, the completion status of jobs is printed
+status.
+If job monitoring is enabled, the completion status of jobs is printed
(this is not the case when jobs are explicitly specified).
.It Xo Ic whence Op Fl pv
.Op Ar name ...
For each
.Ar name ,
the type of command is listed (reserved word, built-in, alias,
-function, tracked alias, or executable). If the
+function, tracked alias, or executable).
+If the
.Fl p
option is used, a path search is performed even if
.Ar name
-is a reserved word, alias, etc. Without the
+is a reserved word, alias, etc.
+Without the
.Fl v
option,
.Ic whence
.Ic command Fl v
except that
.Ic whence
-will find reserved words and won't print aliases as alias commands. With the
+will find reserved words and won't print aliases as alias commands.
+With the
.Fl v
option,
.Ic whence
.El
.Ss Job control
Job control refers to the shell's ability to monitor and control jobs, which
-are processes or groups of processes created for commands or pipelines. At a
-minimum, the shell keeps track of the status of the background (i.e.,
+are processes or groups of processes created for commands or pipelines.
+At a minimum, the shell keeps track of the status of the background (i.e.,
asynchronous) jobs that currently exist; this information can be displayed
using the
.Ic jobs
-commands. If job control is fully enabled (using
+commands.
+If job control is fully enabled (using
.Ic set Fl m
or
.Ic set Fl o Ic monitor ) ,
as it is for interactive shells, the processes of a job are placed in their
-own process group. Foreground jobs can be stopped by typing the suspend
+own process group.
+Foreground jobs can be stopped by typing the suspend
character from the terminal (normally ^Z), jobs can be restarted in either the
foreground or background using the
.Ic fg
.Ic read
cannot be.
.Pp
-When a job is created, it is assigned a job number. For interactive shells,
-this number is printed inside
+When a job is created, it is assigned a job number.
+For interactive shells, this number is printed inside
.Dq \&[..\&] ,
followed by the process IDs of the processes in the job when an asynchronous
-command is run. A job may be referred to in
+command is run.
+A job may be referred to in
.Ic bg ,
.Ic fg ,
.Ic jobs ,
.It Ar signal-description Op Dq core dumped
The job was killed by a signal (e.g., memory fault, hangup, etc.; use
.Ic kill -l
-for a list of signal descriptions). The
+for a list of signal descriptions).
+The
.Dq core dumped
message indicates the process created a core file.
.El
.It Ar command
-is the command that created the process. If there are multiple processes in
+is the command that created the process.
+If there are multiple processes in
the job, each process will have a line showing its
.Ar command
and possibly its
If another attempt is immediately made to exit the shell, the stopped jobs are
sent a
.Dv SIGHUP
-signal and the shell exits. Similarly, if the
+signal and the shell exits.
+Similarly, if the
.Ic nohup
option is not set and there are running jobs when an attempt is made to exit
-a login shell, the shell warns the user and does not exit. If another attempt
+a login shell, the shell warns the user and does not exit.
+If another attempt
is immediately made to exit the shell, the running jobs are sent a
.Dv SIGHUP
signal and the shell exits.
.Ss Emacs editing mode
When the
.Ic emacs
-option is set, interactive input line editing is enabled. Warning: This mode is
+option is set, interactive input line editing is enabled.
+Warning: This mode is
slightly different from the emacs mode in the original Korn shell and the 8th
-bit is stripped in emacs mode. In this mode, various editing commands
+bit is stripped in emacs mode.
+In this 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
+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
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
+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
+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.
+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
string, which may contain editing commands.
.El
.Pp
-The following is a list of available editing commands. Each description starts
-with the name of the command, an
+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
bound to by default (written using caret notation, i.e.,
.Tn "ASCII ESC"
character is
-written as ^[). A count prefix for a command is entered using the sequence
+written as ^[).
+A count prefix for a command is entered using the sequence
.Ic ^\&[ Ns Ar n ,
where
.Ar n
is a sequence of 1 or more digits; unless otherwise specified, if a count is
-omitted, it defaults to 1. Note that editing command names are used only with
-the
+omitted, it defaults to 1.
+Note that editing command names are used only with the
.Ic bind
-command. Furthermore, many editing commands are useful only on terminals with
-a visible cursor. The default bindings were chosen to resemble corresponding
-Emacs key bindings. The users' tty characters (e.g.,
+command.
+Furthermore, many editing commands are useful only on terminals with
+a visible cursor.
+The default bindings were chosen to resemble corresponding
+Emacs key bindings.
+The users' tty characters (e.g.,
.Dv ERASE )
are bound to
reasonable substitutes and override the default bindings.
.Ic search-history
pattern in order to about the search.
.It Ic auto-insert Ar n
-Simply causes the character to appear as literal input. Most ordinary
-characters are bound to this.
+Simply causes the character to appear as literal input.
+Most ordinary characters are bound to this.
.It Ic backward-char Ar n Ic ^B
Moves the cursor backward
.Ar n
.It Ic complete ^[^[
.It Ic complete ^I
Automatically completes as much as is unique of the command name or the file
-name containing the cursor. If the entire remaining command or file name is
+name containing the cursor.
+If the entire remaining command or file name is
unique, a space is printed after its completion, unless it is a directory name
in which case
.Ql /
-is appended. If there is no command or file name with the current partialword
+is appended.
+If there is no command or file name with the current partialword
as its prefix, a bell character is output (usually causing a beep to be
sounded).
.It Ic complete-command ^X^[
.It Ic down-history Ar n Ic ^N
Scrolls the history buffer forward
.Ar n
-lines (later). Each input line originally starts just after the last entry
+lines (later).
+Each input line originally starts just after the last entry
in the history buffer, so
.Ic down-history
is not useful until either
Appends a
.Ql *
to the current word and replaces the word with the result of performing file
-globbing on the word. If no files match the pattern, the bell is rung.
+globbing on the word.
+If no files match the pattern, the bell is rung.
.It Ic forward-char Ar n Ic ^F
Moves the cursor forward
.Ar n
.Ar n .
.It Ic list ^[?
Prints a sorted, columnated list of command named or file names (if any) that
-can complete the partial word containing the cursor. Directoary names have
+can complete the partial word containing the cursor.
+Directoary names have
.Ql /
appended to them.
.It Ic list-command ^X?
the partial word containg the cursor.
.It Ic list-file ^X^Y
Prints a sorted, comunated list of file names (if any) that can complete the
-partial word containing the cursor. File type indicators are appended as
-described under
+partial word containing the cursor.
+File type indicators are appended as described under
.Ic list
above.
.It Ic newline ^J , ^M
-Causes the current input line to be processed by the shell. The current cursor
-position may be anywhere on the line.
+Causes the current input line to be processed by the shell.
+The current cursor position may be anywhere on the line.
.It Ic newline-and-next ^O
Causes the current input line to be processed by the shell, and the next line
-from history becomes the current line. This is only useful after an
+from history becomes the current line.
+This is only useful after an
.Ic up-history
or
.ic search-history .
.Ar n Ns th
occurrence of the next character typed.
.It Ic search-history ^R
-Enter incremental search mode. The internal history list is searched
-backwards for commands matching the input. An initial
+Enter incremental search mode.
+The internal history list is searched
+backwards for commands matching the input.
+An initial
.Ql ^
-in the search string anchors the search. The abort key will leave search mode.
-Other commands will be executed after leaving search mode. Successive
+in the search string anchors the search.
+The abort key will leave search mode.
+Other commands will be executed after leaving search mode.
+Successive
.Ic search-history
commands continue searching backward to the next previous occurrence of the
-pattern. The history buffer retains only a finite number of lines; the oldest
+pattern.
+The history buffer retains only a finite number of lines; the oldest
are discarded as necessary.
.It Ic set-mark-command ^[ Ns No <space>
Set the mark at the cursor position.
.It Ic stuff
On systems supporting it, puhses the bound character back onto the terminal
-input where it may receive special processing by the terminal handler. This
-is useful for the BRL ^T mini-systat feature, for example.
+input where it may receive special processing by the terminal handler.
+This is useful for the BRL ^T mini-systat feature, for example.
.It Ic stuff-reset
Acts like
.Ic stuff ,
.Ar n
words.
.It Ic version ^V
-Display the version of ksh. The current edit buffer is restored as soon as any
+Display the version of ksh.
+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
Inserts the most recently killed text string at the current cursor position.
.Dq insert
mode and
.Dq command
-mode. In insert mode, most characters are simply put in the buffer at the
+mode.
+In insert mode, most characters are simply put in the buffer at the
current cursor position as they are typed; however, some characters are
-treated specially. In particular, the following characters are taken from
+treated specially.
+In particular, the following characters are taken from
current tty 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). In addition to
+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
.It Ic ^H
Erases previous character.
.It Ic ^V
-Liternal next. The next character typed is not treated specially (can be used
+Liternal next.
+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.
+End of line.
+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
Command and file name enumeration (see below).
.It Ic ^F
-Command and file name completion (see below). If used twice in a row, the
+Command and file name completion (see below).
+If used twice in a row, the
list of possible completions is displayed; if used a third time, the completion
is undone.
.It Ic ^X
.Ic set Fl o Ic vi-tabcomplete .
.El
.Pp
-In command mode, each character is interpreted as a command. Characters that
+In command mode, each character is interpreted as a command.
+Characters that
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
+commands that can't be carried out all cause beeps.
+In the following command descriptions, an
.Ar n
indicates the command may be prefixed by a number (e.g.,
.Ic 10l
moves right 10 characters); if no number prefix is used,
.Ar n
-is assumed to be 1 unless otherwise specified. The term
+is assumed to be 1 unless otherwise specified.
+The term
.Dq current position
refers to the position between the cursor and the character preceding the
-cursor. A
+cursor.
+A
.Dq word
is a sequence of letters, digits and underscore characters or a sequence of
non-letter, non-digit, non-underscore, non-whitespace characters (e.g.,
.Ar n
using the vi editor; if
.Ar n
-is not specified, the current line is edited. The actual command executed is
+is not specified, the current line is edited.
+The actual command executed is
.Ic fc Fl e Ic ${VISUAL;-${EDITOR:-vi}} Ar n .
.It Ic \&* No and Ic ^X
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
-with the resulting words. If the current big-word is the first on the line (or
+with the resulting words.
+If the current big-word is the first on the line (or
follows one of the following characters:
.Ql \&; ,
.Ql | ,
built-in commands as well as any executable files found by searching the
directories in the
.Ev PATH
-parameter. File name expansion matches the big-word against the files in the
-current directory. After expansion, the cursor is places just past the last
+parameter.
+File name expansion matches the big-word against the files in the
+current directory.
+After expansion, the cursor is places just past the last
word and the editor is in insert mode.
.It n\e,\ n^F,\ n<tab>,\ and\ n<esc>
-Command/file name completion. Replace the current big-word with the
+Command/file name completion.
+Replace the current big-word with the
longest unique match obtained after performing command and file name expansion.
.Ic <tab>
is only recognized if the
possible completion is selected (as reported by the command/file name
enumeration command).
.It Ic \&= No and Ic ^E
-Command/file name enumeration. List all the commands or files that match the
-current big-word.
+Command/file name enumeration.
+List all the commands or files that match the current big-word.
.It Ic ^V
Display the version of
.Nm pdksh ;
it is displayed until another key is pressed (this key is ignored).
.It Ic @ Ns Ar c
-Macro expansion. Execute the commands found in the alias
+Macro expansion.
+Execute the commands found in the alias
.Ar c .
.El
.Pp
.Ar n
big-words.
.It Ic %
-Find match. The editor looks forward for the nearest parenthesis, bracket or
+Find match.
+The editor looks forward for the nearest parenthesis, bracket or
brace and then moves the cursor to the matching parenthesis, bracket or brace.
.It Ar n Ns Ic f Ns Ar c
Move forward to the
.It Ar n Ns Ic a
Append text
.Ar n
-times; goes into insert mode just after the current position. The append is
+times; goes into insert mode just after the current position.
+The append is
only replicated if command mode is re-entered (i.e., <esc> is used).
.It Ar n Ns Ic A
Same as
.It Ar n Ns Ic i
Insert text
.Ar n
-times; goes into insert mode at the current position. The insertion is only
+times; goes into insert mode at the current position.
+The insertion is only
replicated if command mode is re-entered (i.e., <esc> is used).
.It Ar n Ns Ic I
Same as
.Ar n
characters (i.e., delete the characters and go into insert mode).
.It Ic S
-Substitute whole line. All characters from the first non-blank character to the
+Substitute whole line.
+All characters from the first non-blank character to the
end of the line are deleted and insert mode is entered.
.It Ar n Ns Ic c Ns Ar move-cmd
Change from the current position to the position resulting from
characters with the character
.Ar c .
.It Ar n Ns Ic R
-Replace. Enter insert mode but overwrite existing characters instead of
-inserting before existing characters. The replacement is repeated
+Replace.
+Enter insert mode but overwrite existing characters instead of
+inserting before existing characters.
+The replacement is repeated
.Ar n
times.
.It Ar n Ns Ic \&~
.Sh BUGS
Any bugs in
.Nm pdksh
-should be reported to pdksh@cs.mun.ca. Please include the version of
+should be reported to pdksh@cs.mun.ca.
+Please include the version of
.Nm pdksh
.Po
.Ic echo $KSH_VERSION
.Pa config.h
(the file generated by the
.Pa configure
-script). New version of
+script).
+New versions of
.Nm pdksh
can be obtained from ftp://ftp.cs.mun.ca/pub/pdksh.
.Pp
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
-Ron Natalie, Arnold Robbins, Lou Salkind, and others. The first release of
+Ron Natalie, Arnold Robbins, Lou Salkind, and others.
+The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
-The current maintainer is Michael Rendell (michael@cs.mun.ca). The
+The current maintainer is Michael Rendell (michael@cs.mun.ca).
+The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
-.\" $OpenBSD: sh.1,v 1.16 1999/07/05 19:50:53 aaron Exp $
+.\" $OpenBSD: sh.1,v 1.17 2000/03/17 18:15:16 aaron Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
nor the
.Fl s
option is specified, the first non-option argument specifies the name
-of a file the shell reads commands from. If there are no non-option
-arguments, the shell reads commands from the standard input. The name of
+of a file the shell reads commands from.
+If there are no non-option
+arguments, the shell reads commands from the standard input.
+The name of
the shell (i.e., the contents of $0) is determined as follows: if the
.Fl c
option is used and there is a non-option argument, it is used as the name;
if the
.Fl i
option is used or if both standard input and standard error are attached
-to a tty. An interactive shell has job control enabled (if available),
-ignores the
+to a tty.
+An interactive shell has job control enabled (if available), ignores the
.Dv SIGINT ,
.Dv SIGQUIT ,
and
.Pa $HOME/.profile
nor the
.Ev ENV
-parameter (see below). Instead, the file
+parameter (see below).
+Instead, the file
.Pa /etc/suid_profile
-is processed. Clearing the privileged option causes the shell to set
+is processed.
+Clearing the privileged option causes the shell to set
its effective user ID (group ID) to its real user ID (group ID).
.Pp
If the basename of the name the shell is called with (i.e., argv[0])
command, arithmetic, and tilde
.Pq Sq \&~
substitution and the resulting file
-(if any) is read and executed. If the
+(if any) is read and executed.
+If the
.Ev ENV
parameter is not set (and not
.Dv NULL )
.Pp
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,
+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
command is executed.
.Ss Command syntax
.Ql \&)
.Pc .
Aside from delimiting words, spaces and tabs are ignored, while newlines
-usually delimit commands. The meta-characters are used in building the
-following tokens:
+usually delimit commands.
+The meta-characters are used in building the following tokens:
.Ql < ,
.Ql <& ,
.Ql << ,
.Pq Sq \&"
or single
.Pq Sq \&'
-quotes. Note that the following characters are also treated specially by the
+quotes.
+Note that the following characters are also treated specially by the
shell and must be quoted if they are to represent themselves:
.Ql \e ,
.Ql \&" ,
.Sx Input/output redirections
below),
and command words; the only restriction is that parameter assignments come
-before any command words. The command words, if any, define the command
-that is to be executed and its arguments. The command may be a shell built-in
+before any command words.
+The command words, if any, define the command
+that is to be executed and its arguments.
+The command may be a shell built-in
command, a function or an external command (i.e., a separate executable file
that is located using the
.Ev PATH
be executed, the exit status is 126); the exit status of other command
constructs (built-in commands, functions, compound-commands, pipelines, lists,
etc.) are all well-defined and are described where the construct is
-described. The exit status of a command consisting only of parameter
+described.
+The exit status of a command consisting only of parameter
assignments is that of the last command substitution performed during the
parameter assignment or 0 is there were no command substitutions.
.Pp
token to form pipelines, in which the standard output of each command but the
last is piped (see
.Xr pipe 2 )
-to the standard input of the following command. The exit status of a pipeline
-is that of its last command. A pipeline may be prefixed by the
+to the standard input of the following command.
+The exit status of a pipeline is that of its last command.
+A pipeline may be prefixed by the
.Ql !
reversed word which causes the exit status of the pipeline to be logically
complemented: if the original status was 0 the complemented status will be 1;
.Ql &&
and
.Ql ||
-have equal precedence which is higher that that of
+have equal precedence which is higher than that of
.Ql & ,
.Ql |&
and
.Ql \&; ,
-which also have equal precedence. The
+which also have equal precedence.
+The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
the shell starts the command but does not wait for it to complete (the shell
does keep track of the status of asynchronous commands, see
.Sx Job control
-below). When an asynchronous command is started when job control is disabled
+below).
+When an asynchronous command is started when job control is disabled
(i.e., in most scripts), the command is started with signals
.Dv SIGINT
and
The exit status of a list is that of the last command executed, with the
exception of asynchronous lists, for which the exit status is 0.
.Pp
-Compound commands are created using the following reserved words. These words
+Compound commands are created using the following reserved words.
+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):
.Sy Note:
Some shells (but not this one) execute control structure commands in a
subshell when one or more of their file descriptors are redirected, so any
-environment changes inside them may fail. To be portable, the
+environment changes inside them may fail.
+To be portable, the
.Ic exec
statement should be used instead to redirect file descriptors before the
control structure.
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
-a (syntactically correct) reserved word. For example,
+a (syntactically correct) reserved word.
+For example,
.Pp
.Bl -inset -indent -compact
.It Ic { echo foo; echo bar; }
.It Ic \&( Ar list Ic \&)
Execute
.Ar list
-in a subshell. There is no implicit way to pass environment changes from a
+in a subshell.
+There is no implicit way to pass environment changes from a
subshell back to its parent.
.It Ic \&{ Ar list Ic \&}
Compound construct;
.Ar list
-is executed, but not in a subshell. Note that
+is executed, but not in a subshell.
+Note that
.Ic \&{
and
.Ic \&}
.Ar pattern Ns s ;
the
.Ar list
-associated with the first successfully matched pattern is executed. Patterns
-used in
+associated with the first successfully matched pattern is executed.
+Patterns used in
.Ic case
statements are the same as those used for file name patterns except that the
restrictions regarding
.Ql \&.
and
.Ql /
-are dropped. Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted. Both the word and the
+are dropped.
+Note that any unquoted space before and after a pattern is
+stripped; any space with a pattern must be quoted.
+Both the word and the
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
+well as tilde substitution.
+For historical reasons, open and close braces may be used instead of
.Ic in
and
.Ic esac
.Ar name
is set to the word and
.Ar list
-is executed. If
+is executed.
+If
.Ic in
is not used to specify a word list, the positional parameters ($1, $2, etc.)
-are used instead. For historical reasons, open and close braces may be used
-instead of
+are used instead.
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Ar list
following the
.Ic elif ,
-if any, is executed with similar consequences. If all the lists following
-the
+if any, is executed with similar consequences.
+If all the lists following the
.Ic if
and
.Ic elif Ns s
.Ar list
following the
.Ic else
-is executed. The exit status of an
+is executed.
+The exit status of an
.Ic if
statement is that of non-conditional
.Ar list
.Xc
A
.Ic while
-is a pre-checked loop. Its body is executed as often as the exit status of
-the first
+is a pre-checked loop.
+Its body is executed as often as the exit status of the first
.Ar list
-is zero. The exit status of a
+is zero.
+The exit status of a
.Ic while
statement is the last exit status of the
.Ar list
.Ar name
(see
.Sx Functions
-below). Note that redirections specified after a function definition are
+below).
+Note that redirections specified after a function definition are
performed whenever the function is executed, not when the function definition
is executed.
.It Ar name Ic () Ar command
.El
.Ss Quoting
Quoting is used to prevent the shell from treating characters or words
-specially. There are three methods of quoting. First,
+specially.
+There are three methods of quoting.
+First,
.Ql \e
quotes the following character, unless it is at the end of a line, in which
case both the
.Ql \e
-and the newline are stripped. Second, a single quote
+and the newline are stripped.
+Second, a single quote
.Pq Sq '
-quotes everything up to the next single quote (this may span lines). Third,
-a double quote
+quotes everything up to the next single quote (this may span lines).
+Third, a double quote
.Pq Sq \&"
quotes all characters, except
.Ql $ ,
.Ql `
inside double quotes have their usual meaning (i.e., parameter, command or
arithmetic substitution) except no field splitting is carried out on the
-results of double-quoted substitutions. If a
+results of double-quoted substitutions.
+If a
.Ql \e
inside a double-quoted string is followed by
.Ql \e ,
.Ss Aliases
There are two types of aliases: normal command aliases and tracked aliases.
Command aliases are normally used as a short hand for a long or often used
-command. The shell expands command aliases (i.e., substitutes the alias name
-for its value) when it reads the first word of a command. An expanded alias
-is re-processed to check for more aliases. If a command alias ends in a
-space or tab, the following word is also checked for alias expansion. The
-alias expansion process stops when a word that is not an alias is found, when
-a quoted word is found or when an alias word that is currently being expanded
-is found.
+command.
+The shell expands command aliases (i.e., substitutes the alias name
+for its value) when it reads the first word of a command.
+An expanded alias is re-processed to check for more aliases.
+If a command alias ends in a
+space or tab, the following word is also checked for alias expansion.
+The alias expansion process stops when a word that is not an alias is found,
+when a quoted word is found or when an alias word that is currently being
+expanded is found.
.Pp
The following command aliases are defined automatically by the shell:
.Pp
.El
.Pp
Tracked aliases allow the shell to remember where it found a particular
-command. 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
+command.
+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. Tracked aliases
-can be listed and created using
+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
.Ev PATH
-parameter clears the saved paths for all tracked aliases. If the
+parameter clears the saved paths for all tracked aliases.
+If the
.Ic trackall
option is set (i.e.,
.Ic set Fl o Ic trackall
or
.Ic set Fl h ) ,
-the shell tracks all commands. This option is set automatically for
-non-interactive shells. For interactive shells, only the following commands are
+the shell tracks all commands.
+This option is set automatically for non-interactive shells.
+For interactive shells, only the following commands are
automatically tracked:
.Ic cat , cc , chmod , cp ,
.Ic date , ed , emacs , grep ,
.Ic who .
.Ss Substitution
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. Parameter substitutions,
+substitutions on the words of the command.
+There are three kinds of
+substitution: parameter, command, and arithmetic.
+Parameter substitutions,
which are described in detail in the next section, take the form
-.Ic $name
+.Ic $ Ns Ar name
or
-.Ic ${...} ;
+.Ic ${ Ns Ar ... Ns Ic \&} ;
command substitutions take the form
-.Ic $( Ns Ar command Ns Ic )
+.Ic $( Ns Ar command Ns Ic \&)
or
.Ic ` Ns Ar command Ns Ic ` ;
and arithmetic substitutions take the form
substitution are generally subject to word or field splitting according to
the current value of the
.Ev IFS
-parameter. The
+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
whitespace characters, in combination with zero or no
.Pf non- Ev IFS
whitespace
-characters, delimit a field. As a special case, leading and trailing
+characters, delimit a field.
+As a special case, leading and trailing
.Ev IFS
whitespace is stripped (i.e., no leading or trailing empty field is created by
it); leading or trailing
value of space, tab, and newline is used.
.Pp
Also, note that the field splitting applies only to the immediate result of
-the substitution. Using the previous example, the substitution for $VAR:E
+the substitution.
+Using the previous example, the substitution for $VAR:E
results in the fields:
.Dq A ,
.Dq B ,
brace expansion and file name expansion (see the relevant sections below).
.Pp
A command substitution is replaced by the output generated by the specified
-command, which is run in a subshell. For
-.Ic $( Ns Ar command Ns Ic )
+command, which is run in a subshell.
+For
+.Ic $( Ns Ar command Ns Ic \&)
substitutions, normal quoting rules are used when
.Ar command
is parsed; however, for the
.Ql \e
is stripped (a
.Ql \e
-followed by any other character is unchanged). As a special case in command
-substitutions, a command of the form
+followed by any other character is unchanged).
+As a special case in command substitutions, a command of the form
.Ic \&< Ar file
is interpreted to mean substitute the contents of
.Ar file
.Sy Note:
.Ic $( Ns Ar command Ns Ic \&)
expressions are currently parsed by finding the matching parenthesis,
-regardless of quoting. This should be fixed soon.
+regardless of quoting.
+This should be fixed soon.
.Pp
Arithmetic substitutions are replaced by the value of the specified expression.
For example, the command
.Ic echo $((2+3*4))
-prints 14. See
+prints 14.
+See
.Sx Arithmetic expressions
for a description of an expression.
.Ss Parameters
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
+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
.Po
.Ic ${ Ns Ar name Ns Ic \&} ,
where
.Ar name
-is a parameter name. If substitution is performed on a parameter that is not
-set, a
-.Dv NULL
-string is substituted unless the
+is a parameter name.
+If substitution is performed on a parameter that is not set, a
+null string is substituted unless the
.Ic nounset
option
.Po
.Pc
is set, in which case an error occurs.
.Pp
-Parameters can be assigned valued in a number of ways. First, the shell
-implicitly sets some parameters like
+Parameters can be assigned valued in a number of ways.
+First, the shell implicitly sets some parameters like
.Ic # , PWD ,
etc.; this is the only way the special single character parameters are set.
-Second, parameters are imported from the shell's environment at startup. Third,
-parameters can be assigned values on the command line, for example,
+Second, parameters are imported from the shell's environment at startup.
+Third, parameters can be assigned values on the command line, for example,
.Ic FOO=bar
sets the parameter
.Ev FOO
multiple parameter assignments can be given on a single command line and they
can be followed by a simple-command, in which case the assignments are in
effect only for the duration of the command (such assignments are also
-exported, see below for implications of this). Note that both the parameter
-name and the
+exported, see below for implications of this).
+Note that both the parameter name and the
.Ql =
-must be unquoted for the shell to recognize a parameter assignment. The fourth
-way of setting a parameter is with the
+must be unquoted for the shell to recognize a parameter assignment.
+The fourth way of setting a parameter is with the
.Ic export ,
.Ic readonly
and
.Ic typeset
commands; see their descriptions in the
.Sx Command execution
-section. Fifth,
+section.
+Fifth,
.Ic for
loops set parameters as well as the
.Ic getopts ,
.Ic read
and
.Ic set Fl A
-commands. Lastly, parameters can be assigned values using assignment operators
+commands.
+Lastly, parameters can be assigned values using assignment operators
inside arithmetic expressions (see
.Sx Arithmetic expressions
below) or using the
.Xr environ 5 )
of commands run by the shell as
.Ar name Ns No = Ns Ar value
-pairs. The order in which parameters appear in the environment of a command is
-unspecified. When the shell starts up, it extracts parameters and their values
+pairs.
+The order in which parameters appear in the environment of a command is
+unspecified.
+When the shell starts up, it extracts parameters and their values
from its environment and automatically sets the export attribute for those
parameters.
.Pp
is printed on standard error (preceded by
.Ar name Ns No \&: )
and an error occurs (normally causing termination of a shell script, function
-or .-script). If word is omitted the string
+or .-script).
+If word is omitted the string
.Dq parameter null or not set
is used instead.
.El
.Ar pattern
matches the beginning of the value of parameter
.Ar name ,
-the matched text is deleted from the result of substitution. A single
+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.
set directly using assignments:
.Bl -tag -width "1 ... 9"
.It Ev \&!
-Process ID of the last background process started. If no background processes
-have been started, the parameter is not set.
+Process ID of the last background process started.
+If no background processes have been started, the parameter is not set.
.It Ev \&#
The number of positional parameters (i.e., $1, $2, etc.).
.It Ev \&$
.Ic set
command below for list of options).
.It Ev \&?
-The exit status of the last non-asynchronous command executed. If the last
-command was killed by a signal,
+The exit status of the last non-asynchronous command executed.
+If the last command was killed by a signal,
.Ic \&$\&?
is set to 128 plus the signal number.
.It Ev 0
.Ar command-name
was supplied, or the
.Ar file
-argument, if it was supplied. If the
+argument, if it was supplied.
+If the
.Ic posix
option is not set,
.Ic \&$0
is the name of the current function or script.
.It Ev 1 ... Ev 9
The first nine positional parameters that were supplied to the shell, function
-or .-script. Further positional parameters may be accessed using
+or .-script.
+Further positional parameters may be accessed using
.Ic ${ Ns Ar number Ns Ic \&} .
.It Ev \&*
-All positional parameters (except parameter 0), i.e., $1, $2, $3... If used
+All positional parameters (except parameter 0), i.e., $1, $2, $3...
+If used
outside of double quotes, parameters are separate words (which are subjected
to word splitting); if used within double quotes, parameters are separated
by the first character of the
Same as
.Ic \&$\&* ,
unless it is used inside double quotes, in which case a separate word is
-generated for each positional parameter. If there are no positional parameters,
-no word is generated.
+generated for each positional parameter.
+If there are no positional parameters, no word is generated.
.Ic \&$\&@
can be used to access arguments, verbatim, without losing
.Dv NULL
.It Ev CDPATH
Search path for the
.Ic cd
-built-in command. Works the same way as
+built-in command.
+Works the same way as
.Ev PATH
for those directories not beginning with
.Ql /
in
.Ic cd
-commands. Note that if
+commands.
+Note that if
.Ev CDPATH
is set and does not contain
.Dq \&.
-or contains an empty path, the current directory is not searched. Also, the
+or contains an empty path, the current directory is not searched.
+Also, the
.Ic cd
built-in command will display the resulting directory when a match is found
in any search path other than the empty path.
.It Ev COLUMNS
-Set to the number of columns on the terminal or window. Currently set to the
+Set to the number of columns on the terminal or window.
+Currently set to the
.Dq cols
value as reported by
.Xr stty 1
-if that value is non-zero. This parameter is used by
+if that value is non-zero.
+This parameter is used by
.Ic set Fl o
and
.Ic kill -l
commands to format information columns.
.It Ev ENV
If this parameter is found to be set after any profile files are executed, the
-expanded value is used as a shell startup file. It typically contains function
-and alias definitions.
+expanded value is used as a shell startup file.
+It typically contains function and alias definitions.
.It Ev ERRNO
Integer value of the shell's
.Va errno
-variable. It indicates the reason the last system call failed. Not yet
-implemented.
+variable.
+It indicates the reason the last system call failed.
+Not yet implemented.
.It Ev EXECSHELL
If set, this parameter is assumed to contain the shell that is to be used to
execute commands that
Like
.Ev PATH ,
but used when an undefined function is executed to locate the file defining the
-function. It is also searched when a command can't be found using
+function.
+It is also searched when a command can't be found using
.Ev PATH .
See
.Sx Functions
Internal field separator, used during substitution and by the
.Ic read
command, to split values into distinct arguments; normally set to space, tab
-and newline. See
+and newline.
+See
.Sx Substitution
above for details.
.Pp
The line number of the function or shell script that is currently being
executed.
.It Ev LINES
-Set to the number of lines on the terminal or window. Not yet implemented.
+Set to the number of lines on the terminal or window.
+Not yet implemented.
.It Ev OLDPWD
-The previous working directory. Unset if
+The previous working directory.
+Unset if
.Ic cd
has not successfully changed directories since the shell started, or if the
shell doesn't know where it is.
to process arguments from the beginning the next time it is invoked.
.It Ev PATH
A colon separated list of directories that are searched when looking for
-commands and .'d files. An empty string resulting from a leading or trailing
+commands and .'d files.
+An empty string resulting from a leading or trailing
colon, or two adjacent colons, is treated as a
.Dq \&. ,
the current directory.
.It Ev POSIXLY_CORRECT
If set, this parameter causes the
.Ic posix
-option to be enabled. See
+option to be enabled.
+See
.Sx POSIX mode
below.
.It Ev PPID
.It Ev PS4
Used to prefix commands that are printed during execution tracing (see
.Ic set Fl x
-command below). The prompt is printed verbatim (i.e., no substitutions are
-done). Default is
+command below).
+The prompt is printed verbatim (i.e., no substitutions are done).
+Default is
.Dq \&+\ \& .
.It Ev PWD
-The current working directory. May be unset or
+The current working directory.
+May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev REPLY
.Ic read
command if no names are given.
.It Ev TMPDIR
-The directory shell temporary files are created in. If this parameter is not
+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
files are created in
.Pa /tmp .
.Ql ~ .
The characters following the tilde, up to the first
.Ql / ,
-if any, are assumed to be a login name. If the login name is empty,
+if any, are assumed to be a login name.
+If the login name is empty,
.Ql +
or
.Ql - ,
.Ev PWD ,
or
.Ev OLDPWD
-parameter is substituted, respectively. Otherwise, the password file is
+parameter is substituted, respectively.
+Otherwise, the password file is
searched for the login name, and the tilde expression is substituted with the
-user's home directory. If the login name is not found in the password file or
+user's home directory.
+If the login name is not found in the password file or
if any quoting or parameter substitution occurs in the login name, no
substitution is performed.
.Pp
.Ql *
characters or
.Dq [..]
-sequences. Once brace expansion has been performed, the shell replaces file
+sequences.
+Once brace expansion has been performed, the shell replaces file
name patterns with the sorted named of all the files that match the pattern
-(if no files match, the word is left unchanged). The pattern elements have the
-following meaning:
+(if no files match, the word is left unchanged).
+The pattern elements have the following meaning:
.Bl -tag -width Ds
.It Ic \&?
Matches any single character.
.It Ic \&*
Matches any sequence of characters.
.It Ic \&[ Ns No .. Ns Ic \&]
-Matches any of the characters inside the brackets. Ranges of characters can be
+Matches any of the characters inside the brackets.
+Ranges of characters can be
specified by separating two characters by a
.Ql -
(e.g.,
.Dq [a0-9]
matches the letter
.Dq a
-or any digit). In order to represent itself, a
+or any digit).
+In order to represent itself, a
.Ql -
must either be quoted or the first or last character in the character list.
Similarly, a
.Ql \&]
must be quoted or the first character in the list if it is to represent itself
-instead of the end of the list. Also, a
+instead of the end of the list.
+Also, a
.Ql !
appearing at the start of the list has special meaning (see below), so to
represent itself it must be quoted or appear later in the list.
.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
-the shell. Three exceptions to this are commands in pipelines, for which
+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,
asynchronous commands created when job control is disabled, for which standard
input is initially set to be from
.Ar file
does not exist, it is created; if it does exist, is a regular file and the
.Ic noclobber
-option is set, an error occurs; otherwise, the file is truncated. Note that this
-means the command
+option is set, an error occurs; otherwise, the file is truncated.
+Note that this means the command
.Ic cmd < foo > foo
will open
.Ar foo
.Ic \&> ,
except if
.Ar file
-exists it is appended to instead of being truncated. Also, the file is opened
+exists it is appended to instead of being truncated.
+Also, the file is opened
in append mode, so writes always go to the end of the file (see
.Fn open 2 ) .
.It Ic \&< Ar file
the shell copies lines from the command source into a temporary file until a
line matching
.Ar marker
-is read. When the command is executed, standard input is redirected from the
-temporary file. If
+is read.
+When the command is executed, standard input is redirected from the
+temporary file.
+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
.Ql ` ,
.Ql \e ,
and
-.Dq \enewline .
+.Ql \enewline .
If multiple here documents are used on the same command line, they are saved in
order.
.It Ic \&<\&<\&- Ar marker
.Pp
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
+redirection with a single digit.
+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
and
.Ar fd
-arguments of redirections. Note, however, that the results of any file name
+arguments of redirections.
+Note, however, that the results of any file name
generation are only used if a single file is matched; if multiple files match,
-the word with the expanded file name generation characters is used. Note
+the word with the expanded file name generation characters is used.
+Note
that in restricted shells, redirections which can create files cannot be used.
.Pp
For simple-commands, redirections may appear anywhere in the command; for
.Ic if
statements, etc.
.Pc ,
-any redirections must appear at the end. Redirections are processed after
+any redirections must appear at the end.
+Redirections are processed after
pipelines are created and in the order they are given, so
.Pp
.Ic cat /foo/bar 2\&>&1 \&> /dev/null \&| cat -n
.Tn NOT .
.It Ic \&+\&+
Increment; must be applied to a parameter (not a literal or other expression).
-The parameter is incremented by 1. When used as a prefix operator, the result
+The parameter is incremented by 1.
+When used as a prefix operator, the result
is the incremented value of the parameter; when used as a postfix operator, the
result is the original value of the parameter.
.It Ic \&-\&-
except the parameter is decremented by 1.
.It Ic \&,
Separates two arithmetic expressions; the left-hand side is evaluated first,
-then the right. The result is the value of the expression on the right-hand
-side.
+then the right.
+The result is the value of the expression on the right-hand side.
.It Ic =
Assignment; variable on the left is set to the value on the right.
.It Xo Ic \&*= /= \&+= \&-= \&<\&<=
.It Ic \&|\&|
Logical
.Tn OR ;
-the result is 1 if either argument is non-zero, 0 if not. The right
-argument is evaluated only if the left argument is zero.
+the result is 1 if either argument is non-zero, 0 if not.
+The right argument is evaluated only if the left argument is zero.
.It Ic \&&\&&
Logical
.Tn AND ;
-the result is 1 if both arguments are non-zero, 0 if not. The
-right argument is evaluated only if the left argument is non-zero.
+the result is 1 if both arguments are non-zero, 0 if not.
+The right argument is evaluated only if the left argument is non-zero.
.It Ic \&|
Arithmetic (bit-wise)
.Tn OR .
Less than; the result is 1 if the left argument is less than the right, 0 if
not.
.It Ic \&<= \&>= \&>
-Less than or equal, greater than or equal, greater than. See
+Less than or equal, greater than or equal, greater than.
+See
.Ic \&< .
.It Ic \&<\&< \&>\&>
Shift left (right); the result is the left argument with its bits shifted left
Addition, subtraction, multiplication, and division.
.It Ic %
Remainder; the result is the remainder of the division of the left argument by
-the right. The sign of the result is unspecified if either argument is
-negative.
+the right.
+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
.Ic function Ar name
syntax or the Bourne/POSIX shell
.Fn name
-syntax (see below for the difference between the two forms). Functions are like
+syntax (see below for the difference between the two forms).
+Functions are like
.Li .-scripts
-in that they are executed in the current environment. However, unlike
+in that they are executed in the current environment.
+However, unlike
.Li .-scripts ,
shell arguments (i.e., positional parameters $1, $2, etc.) are never visible
-inside them. When the shell is determining the location of a command, functions
+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
.Ev PATH
executed, the shell searches the path specified in the
.Ev FPATH
parameter for a file with the same name as the function, which, if found, is
-read and executed. If after executing the file the named function is found to
+read and executed.
+If after executing the file the named function is found to
be defined, the function is executed; otherwise, the normal command search is
continued (i.e., the shell searches the regular built-in command table and
.Ev PATH ) .
.Ic typeset \&-ft
and
.Ic typeset \&-fx ,
-respectively. When a traced function is executed, the shell's
+respectively.
+When a traced function is executed, the shell's
.Ic xtrace
option is turned on for the function's duration; otherwise, the
.Ic xtrace
-option is turned off. The
+option is turned off.
+The
.Dq export
-attribute of functions is currently not used. In the original Korn shell,
+attribute of functions is currently not used.
+In the original Korn shell,
exported functions are visible to shell scripts that are executed.
.Pp
Since functions are executed in the current shell environment, parameter
assignments made inside functions are visible after the function completes.
If this is not the desired effect, the
.Ic typeset
-command can be used inside a function to create a local parameter. Note that
-special parameters (e.g., $$, $\&!) can't be scoped in this way.
+command can be used inside a function to create a local parameter.
+Note that special parameters (e.g., $$, $\&!) can't be scoped in this way.
.Pp
The exit status of a function is that of the last command executed in the
-function. A function can be made to finish immediately using the
+function.
+A function can be made to finish immediately using the
.Ic return
command; this may also be used to explicitly specify the exit status.
.Pp
.Ic getopts
inside a function interferes with using
.Ic getopts
-outside the function). In the future, the following differences will also be
-added:
+outside the function).
+In the future, the following differences will also be added:
.Bl -bullet -offset indent
.It
A separate trap/signal environment will be used during the execution of
-functions. This will mean that traps set inside a function will not affect the
+functions.
+This will mean that traps set inside a function will not affect the
shell's traps and signals that are not ignored in the shell (but may be
trapped) will have their default effect in a function.
.It
compliant; however, in some cases,
.Tn POSIX
behaviour is contrary either to the original Korn shell behaviour or to user
-convenience. How the shell behaves in these cases is determined by the state
-of the
+convenience.
+How the shell behaves in these cases is determined by the state of the
.Ic posix
option
.Pq Ic set Fl o Ic posix .
If it is on, the
.Tn POSIX
-behaviour is followed; otherwise, it is not. The
+behaviour is followed; otherwise, it is not.
+The
.Ic posix
option is set automatically when the shell starts up if the environment
contains the
.Ic \e\&"
inside double quoted
.Ic `\&.\&.`
-command substitutions. In
+command substitutions.
+In
.Tn POSIX
mode, the
.Ic \e\&"
is interpreted when the command is interpreted; in
.Pf non- Tn POSIX
mode, the
-backslash is stripped before the command substitution is interpreted. For
-example,
+backslash is stripped before the command substitution is interpreted.
+For example,
.Ic echo \&"`echo \e\&"hi\e\&"`\&"
produces
.Dq \&"hi\&"
.Dq hi
in
.Pf non- Tn POSIX
-mode. To avoid problems, use the
+mode.
+To avoid problems, use the
.Ic $(...)
form of command substitution.
.It
.Ic kill -l
-output. In
+output.
+In
.Tn POSIX
mode, signal names are listed one per line; in
.Pf non- Tn POSIX
mode,
-signal numbers, names and descriptions are printed in columns. In future, a new
-option
+signal numbers, names and descriptions are printed in columns.
+In future, a new option
.Po Fl v
\ perhaps
.Pc
will be added to distinguish the two behaviours.
.It
.Ic fg
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status is 0 if no errors occur; in
.Pf non- Tn POSIX
or
.Ql + .
.It
-Brace expansion (also known as alternation). In
+Brace expansion (also known as alternation).
+In
.Tn POSIX
mode, brace expansion is
disabled; in
.Pf non- Tn POSIX
-mode, brace expansion is enabled. Note that
+mode, brace expansion is enabled.
+Note that
.Ic set Fl o Ic posix
(or setting the
.Ev POSIXLY_CORRECT
parameter) automatically turns the
.Ic braceexpand
-option off, although it can be explicitly turned on later.
+option off; however, it can be explicitly turned on later.
.It
.Ic set \&- .
In
mode, it does.
.It
.Ic set
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status of
.Ic set
mode, the exit status is that of any
command substitutions performed in generating the
.Ic set
-command. For example,
+command.
+For example,
.Ic set \&-\&- `false`; echo $?
prints 0 in
.Tn POSIX
mode, 1 in
.Pf non- Tn POSIX
-mode. This construct is used in most shell scripts that use the old
+mode.
+This construct is used in most shell scripts that use the old
.Xr getopt 1
command.
.It
.Ic readonly ,
and
.Ic typeset
-commands. In
+commands.
+In
.Tn POSIX
mode, normal argument expansion is done; in
.Pf non- Tn POSIX
field splitting, file globbing, brace expansion, and (normal) tilde expansion
are turned off, while assignment tilde expansion is turned on.
.It
-Signal specification. In
+Signal specification.
+In
.Tn POSIX
mode, signals can be specified as digits, only
if signal numbers match
.Pf non- Tn POSIX
mode, signals can always be digits.
.It
-Alias expansion. In
+Alias expansion.
+In
.Tn POSIX
mode, alias expansion is only carried out when
reading command words; in
.Pf non- Tn POSIX
mode, alias expansion is carried out on any
-word following an alias that ended in a space. For example, the following
+word following an alias that ended in a space.
+For example, the following
.Ic for
loop
.Pp
.Pf non- Tn POSIX
mode.
.It
-Test. In
+Test.
+In
.Tn POSIX
mode, the expression
.Ql Fl t
.El
.Ss Command execution
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
.Ev PATH
-parameter. The checks are made in the above order. Special built-in commands
-differ from other commands in that the
+parameter.
+The checks are made in the above order.
+Special built-in commands differ from other commands in that the
.Ev PATH
parameter is not used to find them, and an error during their execution can
cause a non-interactive shell to exit and parameter assignments that are
-specified before the command are kept after the command completes. Just to
-confuse things, if the
+specified before the command are kept after the command completes.
+Just to confuse things, if the
.Ic posix
option is turned off (see
.Ic set
command below), some special commands are very special in that no field
splitting, file globbing, brace expansion, nor tilde expansion is performed
-on arguments that look like assignments. Regular built-in commands are
-different only in that the
+on arguments that look like assignments.
+Regular built-in commands are different only in that the
.Ev PATH
parameter is not used to find them.
.Pp
-The original ksh and
+The original
+.Nm ksh
+and
.Tn POSIX
differ somewhat in which commands are considered
special or regular:
.It Ic \&. Ar file Op Ar arg1 ...
Execute the commands in
.Ar file
-in the current environment. The file is searched for in the directories of
+in the current environment.
+The file is searched for in the directories of
.Ev PATH .
If arguments are given, the positional parameters may be used to access them
while
.Ar file
-is being executed. If no arguments are given, the positional parameters are
+is being executed.
+If no arguments are given, the positional parameters are
those of the environment the command is used in.
.It Ic \&: Op Ar ...
-The null command. Exit status is set to zero.
+The null command.
+Exit status is set to zero.
.It Xo Ic alias
.Op Fl d | Ic +-t Op Fl r
.Op Ic +-px
.Xc
Without arguments,
.Ic alias
-lists all aliases. For any name without a value, the existing alias is listed.
+lists all aliases.
+For any name without a value, the existing alias is listed.
Any name with a value defines an alias (see
.Sx Aliases
above).
.Pp
-When listing aliases, one of two formats is used. Normally, aliases are listed
-as
+When listing aliases, one of two formats is used.
+Normally, aliases are listed as
.Ar name Ns No = Ar value ,
where
.Ar value
-is quoted. If options were preceded with
+is quoted.
+If options were preceded with
.Ql + ,
-or a lone \&+ is given on the command line, only
+or a lone
+.Ql +
+is given on the command line, only
.Ar name
-is printed. In addition, if the
+is printed.
+In addition, if the
.Fl p
option is used, each alias is prefixed with the string
.Dq alias\ \& .
The
.Fl t
option indicates that tracked aliases are to be listed/set (values specified on
-the command line are ignored for tracked aliases). The
+the command line are ignored for tracked aliases).
+The
.Fl r
option indicates that all tracked aliases are to be reset.
.Pp
.Sx Tilde expansion
above).
.It Ic bg Op Ar job ...
-Resume the specified stopped job(s) in the background. If no jobs are
-specified,
+Resume the specified stopped job(s) in the background.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+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
.Ar dir .
A
.Dv NULL
-path means the current directory. If
+path means the current directory.
+If
.Ar dir
is found in any component of the
.Ev CDPATH
.Ar dir
is missing, the home directory
.Ev HOME
-is used. If
+is used.
+If
.Ar dir
is
.Ql - ,
the previous working directory is used (see
.Ev OLDPWD
-parameter). If the
+parameter).
+If the
.Fl L
option (logical path) is used or if the
.Ic physical
.Dq \&.\&.
in
.Ar dir
-are relative to the path used to get to the directory. If the
+are relative to the path used to get to the directory.
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
option is set,
.Dq \&.\&.
-is relative to the filesystem directory tree. The
+is relative to the filesystem directory tree.
+The
.Ev PWD
and
.Ev OLDPWD
.Ar cmd
is executed exactly as if
.Ic command
-had not been specified, with two exceptions. First,
+had not been specified, with two exceptions.
+First,
.Ar cmd
cannot be a shell function, and second, special built-in commands lose their
specialness (i.e., redirection and utility errors do not cause the shell to
-exit, and command assignments are not permanent). If the
+exit, and command assignments are not permanent).
+If the
.Fl p
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 POSIXish
+(the actual value of the default path is system dependent: on POSIXish
systems, it is the value returned by
.Ic getconf CS_PATH ) .
.It Ic continue Op Ar level
.Op Ar arg ...
.Xc
Prints its arguments (separated by spaces) followed by a newline, to the
-standard output. The newline is suppressed if any of the arguments contain the
+standard output.
+The newline is suppressed if any of the arguments contain the
backslash sequence
.Ql \ec .
See the
.Pp
The options are provided for compatibility with
.Bx
-shell scripts. The
+shell scripts.
+The
.Fl n
option suppresses the trailing newline,
.Fl e
.Pp
If no command is given except for I/O redirection, the I/O redirection is
permanent and the shell is
-not replaced. Any file descriptors which are opened or
+not replaced.
+Any file descriptors which are opened or
.Xr dup 2 Ns No 'd
in this way are made available to other executed commands (note that the Korn
shell differs here: it does not pass on file descriptors greater than 2).
.It Ic exit Op Ar status
-The shell exits with the specified exit status. If
+The shell exits with the specified exit status.
+If
.Ar status
is not specified, the exit status is the current value of the
.Ic \&?
.It Xo Ic export Op Fl p
.Op Ar parameter Ns Op \&= Ns Ar value
.Xc
-Sets the export attribute of the named parameters. Exported parameters are
-passed in the environment to executed commands. If values are specified, the
-named parameters are also assigned.
+Sets the export attribute of the named parameters.
+Exported parameters are passed in the environment to executed commands.
+If values are specified, the named parameters are also assigned.
.Pp
If no parameters are specified, the names of all parameters with the export
attribute are printed one per line, unless the
This command is usually accessed with the predefined
.Ic alias r='fx -e -' .
.It Ic fg Op Ar job ...
-Resume the specified job(s) in the foreground. If no jobs are specified,
+Resume the specified job(s) in the foreground.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+is assumed.
+This command is only available on systems which support job control (see
.Sx Job control
below for more information).
.It Xo Ic getopts Ar optstring name
.Ar optstring
contains the option letters that
.Ic getopts
-is to recognize. If a letter is followed by a colon, the option is expected to
-have an argument. Options that do not take arguments may be grouped in a single
-argument. If an option takes an argument and the option character is not the
+is to recognize.
+If a letter is followed by a colon, the option is expected to
+have an argument.
+Options that do not take arguments may be grouped in a single argument.
+If an option takes an argument and the option character is not the
last character of the argument it is found in, the remainder of the argument is
taken to be the option's argument; otherwise, the next argument is the option's
argument.
.Ar name
(indicating an illegal option or missing argument, respectively) and
.Ev OPTAG
-is set to the option character that caused the problem. An error message is
-also printed to standard error if
+is set to the option character that caused the problem.
+An error message is also printed to standard error if
.Ar optstring
does not being with a colon.
.Pp
When the end of the options is encountered,
.Ic getopts
-exits with a non-zero exit status. Options end at the first (non-option
+exits with a non-zero exit status.
+Options end at the first (non-option
argument) argument that does not start with a
.Ql - ,
or when a
.It Xo Ic hash Op Fl r
.Op Ar name ...
.Xc
-Without arguments, any hashed executable command pathnames are listed. The
+Without arguments, any hashed executable command pathnames are listed.
+The
.Fl r
-option causes all hashed commands to be removed from the hash table. Each
+option causes all hashed commands to be removed from the hash table.
+Each
.Ar name
is searched as if it were a command name and added to the hash table if it is
an executable command.
.Op Ar job ...
.Xc
Display information about the specified job(s); if no jobs are specified, all
-jobs are displayed. The
+jobs are displayed.
+The
.Fl n
option causes information to be displayed only for jobs that have changed
-state since the last notification. If the
+state since the last notification.
+If the
.Fl l
-option is used, the process ID of each process in a job is also listed. The
+option is used, the process ID of each process in a job is also listed.
+The
.Fl p
-option causes only the process group of each job to be printed. See
+option causes only the process group of each job to be printed.
+See
.Sx Job control
below for the format of
.Ar job
.Ar pgrp No } Ar ...
.Xc
Send the specified signal to the specified jobs, process IDs, or process
-groups. If no signal is specified, the
+groups.
+If no signal is specified, the
.Dv TERM
-signal is sent. If a job is specified, the signal is sent to the job's
-process group. See
+signal is sent.
+If a job is specified, the signal is sent to the job's process group.
+See
.Sx Job control
below for the format of
.Ar job .
.Xc
.Ic print
prints its arguments on the standard output, separated by spaces and
-terminated with a newline. The
+terminated with a newline.
+The
.Fl n
-option suppresses the newline. By default, certain C escapes are translated.
+option suppresses the newline.
+By default, certain C escapes are translated.
These include
.Ql \eb ,
.Ql \ef ,
.Ql \e
expansion may be inhibited with the
.Fl r
-option. The
+option.
+The
.Fl s
option prints to the history file instead of standard output, the
.Fl u
.Ql \e
sequences unless the
.Fl e
-option is given. As above, the
+option is given.
+As above, the
.Fl n
option suppresses the trailing newline.
.It Ic pwd Op Fl LP
-Print the present working directory. If the
+Print the present working directory.
+If the
.Fl L
option is used or if the
.Ic physical
.Ic set
command below) isn't set, the logical path is printed (i.e., the path used to
.Ic cd
-to the current directory). If the
+to the current directory).
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
.Ev IFS
parameter (see
.Sx Substitution
-above), and assigns each field to the specified parameters. If there are more
-parameters than fields, the extra parameters are set to
+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
-is assigned the remaining fields (inclusive of any separating spaces). If no
-parameters are specified, the
+is assigned the remaining fields (inclusive of any separating spaces).
+If no parameters are specified, the
.Ev REPLY
-parameter is used. If the input line ends in a backslash and the
+parameter is used.
+If the input line ends in a backslash and the
.Fl r
option was not used, the backslash and the newline are stripped and more input
-is read. If no input is read,
+is read.
+If no input is read,
.Ic read
exits with a non-zero status.
.Pp
.Ar n
or the current co-process (see
.Sx Co-processes
-above for comments on this), respectively. If the
+above for comments on this), respectively.
+If the
.Fl s
option is used, input is saved to the history file.
.It Xo Ic readonly Op Fl p
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Sets the read-only attribute of the named parameters. If values are given,
-parameters are set to them before setting the attribute. Once a parameter is
+Sets the read-only attribute of the named parameters.
+If values are given,
+parameters are set to them before setting the attribute.
+Once a parameter is
made read-only, it cannot be unset and its value cannot be changed.
.Pp
If no parameters are specified, the names of all parameters with the read-only
.Ar status .
If no
.Ar status
-is given, the exit status of the last executed command is used. If used
-outside of a function or
+is given, the exit status of the last executed command is used.
+If used outside of a function or
.Ic \&.
script, it has the same effect as
.Ic exit .
All new parameters are created with the export attribute.
.It Fl b Ic notify
Print job notification messages asynchronously, instead of just before the
-prompt. Only used if job control is enabled
+prompt.
+Only used if job control is enabled
.Pq Fl m .
.It Fl C Ic noclobber
Prevent
Exit (after executing the
.Dv ERR
trap) as soon as an error occurs or a command fails (i.e., exits with a
-non-zero status). This does not apply to commands whose exit status is
+non-zero status).
+This does not apply to commands whose exit status is
explicitly tested by a shell construct such as
.Ic if ,
.Ic until ,
.It Fl h Ic trackall
Create tracked aliases for all executed commands (see
.Sx Aliases
-above). Enabled by default for non-interactive shells.
+above).
+Enabled by default for non-interactive shells.
.It Fl i Ic interactive
-Enable interactive mode. This can only be set/unset when the shell is invoked.
+Enable interactive mode.
+This can only be set/unset when the shell is invoked.
.It Fl k Ic keyword
Parameter assignments are recognized anywhere in a command.
.It Fl l Ic login
-The shell is a login shell. This can only be set/unset when the shell is
-invoked (see
+The shell is a login shell.
+This can only be set/unset when the shell is invoked (see
.Sx Shell startup
above).
.It Fl m Ic monitor
Enable job control (default for interactive shells).
.It Fl n lc noexec
-Do not execute any commands. Useful for checking the syntax of scripts
+Do not execute any commands.
+Useful for checking the syntax of scripts
(ignored if interactive).
.It Fl p Ic privileged
Set automatically if, when the shell starts, the read UID or GID does not match
-the effective UID (EUID) or GID (EGID), respectively. See
+the effective UID (EUID) or GID (EGID), respectively.
+See
.Sx Shell startup
above for a description of what this means.
.It Fl r Ic restricted
-Enable restricted mode. This option can only be used when the shell is invoked.
+Enable restricted mode.
+This option can only be used when the shell is invoked.
See
.Sx Shell startup
above for a description of what this means.
.It Fl s Ic stdin
-If used where the shell is invoked, commands are read from standard input. Set
-automatically if the shell is invoked with no arguments.
+If used where the shell is invoked, commands are read from standard input.
+Set automatically if the shell is invoked with no arguments.
.Pp
When
.Fl s
.It Ic nohup
Do not kill running jobs with a
.Dv HUP
-signal when a login shell exists. Currently set by default, but this will
+signal when a login shell exists.
+Currently set by default, but this will
change in the future to be compatible with the original Korn shell (which
doesn't have this option, but does send the
.Dv HUP
signal).
.It Ic nolog
-No effect. In the original Korn shell, this prevents function definitions from
+No effect.
+In the original Korn shell, this prevents function definitions from
being stored in the history file.
.It Ic physical
Causes the
.Dq logical
directories (i.e., the shell handles
.Dq \&.\&. ,
-which allows the user to be oblivious of symbolic links to directories). Clear
-by default. Note that setting this option does not affect the current value of
-the
+which allows the user to be oblivious of symbolic links to directories).
+Clear by default.
+Note that setting this option does not affect the current value of the
.Ev PWD
parameter; only the
.Ic cd
.It Ic posix
Enable
.Tn POSIX
-mode. See
+mode.
+See
.Sx POSIX mode
above.
.It Ic vi
Enable vi-like command-line editing (interactive shells only).
.It Ic viraw
-No effect. In the original Korn shell, unless
+No effect.
+In the original Korn shell, unless
.Ic viraw
was set, the vi command-line mode would let the tty driver do the work until
.Tn ESC
is entered in insert mode.
.El
.Pp
-These options can also be used upon invocation of the shell. The current set of
+These options can also be used upon invocation of the shell.
+The current set of
options (with single letter names) can be found in the parameter
.Dv \&- .
.Ic set Fl o
will print the long names of all options that are currently on.
.Pp
Remaining arguments, if any, are positional parameters and are assigned, in
-order, to the positional parameters (i.e., $1, $2, etc.). If options end with
+order, to the positional parameters (i.e., $1, $2, etc.).
+If options end with
.Ql --
-and there are no remaining arguments, all positional parameters are cleared. If
-no options or arguments are given, the values of all names are printed. For
-unknown historical reasons, a lone
+and there are no remaining arguments, all positional parameters are cleared.
+If no options or arguments are given, the values of all names are printed.
+For unknown historical reasons, a lone
.Ql -
option is treated specially -- it clears both the
.Fl x
evaluates the
.Ar expression
and returns zero status if true, 1 status if false, or greater than 1 if there
-was an error. It is normally used as the condition command of
+was an error.
+It is normally used as the condition command of
.Ic if
and
.Ic while
-statements. The following basic expressions are available:
+statements.
+The following basic expressions are available:
.Bl -tag -width 17n
.It Ar str
.Ar str
-has non-zero length. Note that there is the potential for problems if
+has non-zero length.
+Note that there is the potential for problems if
.Ar str
turns out to be an operator (e.g.,
.Fl r ) .
.Ar option
is set (see
.Ic set
-command above for a list of options). As a non-standard extension, if the
-option starts with a
+command above for a list of options).
+As a non-standard extension, if the option starts with a
.Ql ! ,
the test is negated; the test always fails if
.Ar option
.It Fl t Op Ar fd
File descriptor
.Ar fd
-is a tty device. If the
+is a tty device.
+If the
.Ic posix
option is not set,
.Ar fd
.Ic test
command will attempt to fake it for all tests that operate on files (except the
.Fl e
-test). For example,
+test).
+For example,
.Ic \&[ -w /dev/fd/2 \&]
tests if file descriptor 2 is writable.
.Pp
.Dv ALRM )
or the number of the signal (see
.Ic kill -l
-command above). There are two special signals:
+command above).
+There are two special signals:
.Dv EXIT
(also known as 0), which is executed when the shell is about to exit, and
.Dv ERR ,
.Ic set
command above).
.Dv EXIT
-handlers are executed in the environment of the last executed command. Note
+handlers are executed in the environment of the last executed command.
+Note
that for non-interactive shells, the trap handler cannot be changed for signals
that were ignored when the shell started.
.Pp
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Display or set parameter attributes. With no
+Display or set parameter attributes.
+With no
.Ar name
arguments, parameter attributes are displayed; if no options are used, the
current attributes of all parameters are printed as
.Pq Ic \&-
or cleared
.Pq Ic \&+ .
-Values for parameters may optionally be specified. If
+Values for parameters may optionally be specified.
+If
.Ic typeset
is used inside a function, any newly created parameters are local to the
function.
.Fl f
is used,
.Ic typeset
-operates on the attributes of functions. As with parameters, if no
+operates on the attributes of functions.
+As with parameters, if no
.Ar name Ns s
are given, functions are listed with their values (i.e., definitions) unless
options are introduced with
.It Fl L Ns Ar n
Left justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Leading whitespace (and zeros, if used with the
+assigned value) is used.
+Leading whitespace (and zeros, if used with the
.Fl Z
-option) is stripped. If necessary, values are either truncated or space padded
+option) is stripped.
+If necessary, values are either truncated or space padded
to fit the field width.
.It Fl R Ns Ar n
Right justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Trailing whitespace is stripped. If necessary, values
-are either stripped of leading characters or space padded to make them fit the
-field width.
+assigned value) is used.
+Trailing whitespace is stripped.
+If necessary, values are either stripped of leading characters or space
+padded to make them fit the field width.
.It Fl Z Ns Ar n
Zero fill attribute. If not combined with
.Fl L ,
Integer attribute.
.Ar n
specifies the base to use when displaying the integer (if not specified, the
-base given in the first assignment is used). Parameters with this attribute may
+base given in the first assignment is used).
+Parameters with this attribute may
be assigned values containing arithmetic expressions.
.It Fl U
-Unsigned integer attribute. Integers are printed as unsigned values (only
+Unsigned integer attribute.
+Integers are printed as unsigned values (only
useful when combined with the
.Fl i
-option). This option is not in the original Korn shell.
+option).
+This option is not in the original Korn shell.
.It Fl f
-Function mode. Display or set functions and their attributes, instead of
-parameters.
+Function mode.
+Display or set functions and their attributes, instead of parameters.
.It Fl l
-Lower case attribute. All upper case characters in values are converted to
-lower case. (In the original Korn shell, this parameter meant
+Lower case attribute.
+All upper case characters in values are converted to lower case.
+(In the original Korn shell, this parameter meant
.Dq long integer
when used with the
.Fl i
Print complete
.Ic typeset
commands that can be used to re-create the attributes (but not the values) or
-parameters. This is the default action (option exists for ksh93 compatibility).
+parameters.
+This is the default action (option exists for ksh93 compatibility).
.It Fl r
-Read-only attribute. Parameters with this attribute may not be assigned to or
-unset. Once this attribute is set, it can not be turned off.
+Read-only attribute.
+Parameters with this attribute may not be assigned to or unset.
+Once this attribute is set, it can not be turned off.
.It Fl t
-Tag attribute. Has no meaning to the shell; provided for application use.
+Tag attribute.
+Has no meaning to the shell; provided for application use.
.Pp
For functions,
.Fl t
-is the trace attribute. When functions with the trace attribute are executed,
-the
+is the trace attribute.
+When functions with the trace attribute are executed, the
.Ic xtrace
.Pq Fl x
shell option is temporarily turned on.
.It Fl u
-Upper case attribute. All lower case characters in values are converted to
-upper case. (In the original Korn shell, this parameter meant
+Upper case attribute.
+All lower case characters in values are converted to upper case.
+(In the original Korn shell, this parameter meant
.Dq unsigned integer
when used with the
.Fl i
option, which meant upper case letters would never be used for bases greater
-than 10. See the
+than 10.
+See the
.Fl U
option.)
.Pp
For functions,
.Fl u
-is the undefined attribute. See
+is the undefined attribute.
+See
.Sx Functions
above for the implications of this.
.It Fl x
-Export attribute. Parameters (or functions) are placed in the environment of
-any executed commands. Exported functions are not yet implemented.
+Export attribute.
+Parameters (or functions) are placed in the environment of
+any executed commands.
+Exported functions are not yet implemented.
.El
.It Xo Ic ulimit Op Fl acdfHlmnpsStvw
.Op Ar value
.Xc
-Display or set process limits. If no options are used, the file size limit
+Display or set process limits.
+If no options are used, the file size limit
.Pq Fl f
is assumed.
.Ar value ,
if specified, may be either an arithmetic expression or the word
.Dq unlimited .
The limits affect the shell and any processes created by the shell after a
-limit is imposed. Note that some systems may not allow limits to be increased
-once they are set. Also note that the types of limits available are system
+limit is imposed.
+Note that some systems may not allow limits to be increased
+once they are set.
+Also note that the types of limits available are system
dependent -- some systems have only the
.Fl f
limit.
.It Xo Ic unalias Op Fl adt
.Op Ar name1 ...
.Xc
-The aliases for the given names are removed. If the
+The aliases for the given names are removed.
+If the
.Fl a
-option is used, all aliases are removed. If the
+option is used, all aliases are removed.
+If the
.Fl t
or
.Fl d
The exit status is non-zero if any of the parameters were already unset, zero
otherwise.
.It Ic wait Op Ar job ...
-Wait for the specified job(s) to finish. The exit status of
+Wait for the specified job(s) to finish.
+The exit status of
.Ic wait
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
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. See
+is 127.
+See
.Sx Job control
below for the format of
.Ar job .
If no jobs are specified,
.Ic wait
waits for all currently running jobs (if any) to finish and exits with a zero
-status. If job monitoring is enabled, the completion status of jobs is printed
+status.
+If job monitoring is enabled, the completion status of jobs is printed
(this is not the case when jobs are explicitly specified).
.It Xo Ic whence Op Fl pv
.Op Ar name ...
For each
.Ar name ,
the type of command is listed (reserved word, built-in, alias,
-function, tracked alias, or executable). If the
+function, tracked alias, or executable).
+If the
.Fl p
option is used, a path search is performed even if
.Ar name
-is a reserved word, alias, etc. Without the
+is a reserved word, alias, etc.
+Without the
.Fl v
option,
.Ic whence
.Ic command Fl v
except that
.Ic whence
-will find reserved words and won't print aliases as alias commands. With the
+will find reserved words and won't print aliases as alias commands.
+With the
.Fl v
option,
.Ic whence
.El
.Ss Job control
Job control refers to the shell's ability to monitor and control jobs, which
-are processes or groups of processes created for commands or pipelines. At a
-minimum, the shell keeps track of the status of the background (i.e.,
+are processes or groups of processes created for commands or pipelines.
+At a minimum, the shell keeps track of the status of the background (i.e.,
asynchronous) jobs that currently exist; this information can be displayed
using the
.Ic jobs
-commands. If job control is fully enabled (using
+commands.
+If job control is fully enabled (using
.Ic set Fl m
or
.Ic set Fl o Ic monitor ) ,
as it is for interactive shells, the processes of a job are placed in their
-own process group. Foreground jobs can be stopped by typing the suspend
+own process group.
+Foreground jobs can be stopped by typing the suspend
character from the terminal (normally ^Z), jobs can be restarted in either the
foreground or background using the
.Ic fg
.Ic read
cannot be.
.Pp
-When a job is created, it is assigned a job number. For interactive shells,
-this number is printed inside
+When a job is created, it is assigned a job number.
+For interactive shells, this number is printed inside
.Dq \&[..\&] ,
followed by the process IDs of the processes in the job when an asynchronous
-command is run. A job may be referred to in
+command is run.
+A job may be referred to in
.Ic bg ,
.Ic fg ,
.Ic jobs ,
.It Ar signal-description Op Dq core dumped
The job was killed by a signal (e.g., memory fault, hangup, etc.; use
.Ic kill -l
-for a list of signal descriptions). The
+for a list of signal descriptions).
+The
.Dq core dumped
message indicates the process created a core file.
.El
.It Ar command
-is the command that created the process. If there are multiple processes in
+is the command that created the process.
+If there are multiple processes in
the job, each process will have a line showing its
.Ar command
and possibly its
If another attempt is immediately made to exit the shell, the stopped jobs are
sent a
.Dv HUP
-signal and the shell exits. Similarly, if the
+signal and the shell exits.
+Similarly, if the
.Ic nohup
option is not set and there are running jobs when an attempt is made to exit
-a login shell, the shell warns the user and does not exit. If another attempt
+a login shell, the shell warns the user and does not exit.
+If another attempt
is immediately made to exit the shell, the running jobs are sent a
.Dv HUP
signal and the shell exits.
with only those
.Nm ksh
features whose syntax or semantics are incompatible with a traditional Bourne
-shell disabled. Since this leaves some
+shell disabled.
+Since this leaves some
.Nm ksh
extensions exposed, caution should be used where backwards compatibility with
traditional Bourne or
.Sh BUGS
Any bugs in
.Nm pdksh
-should be reported to pdksh@cs.mun.ca. Please include the version of
+should be reported to pdksh@cs.mun.ca.
+Please include the version of
.Nm pdksh
.Po
.Ic echo $KSH_VERSION
.Pa config.h
(the file generated by the
.Pa configure
-script). New version of
+script).
+New versions of
.Nm pdksh
can be obtained from ftp://ftp.cs.mun.ca/pub/pdksh.
.Pp
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
-Ron Natalie, Arnold Robbins, Lou Salkind, and others. The first release of
+Ron Natalie, Arnold Robbins, Lou Salkind, and others.
+The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
-The current maintainer is Michael Rendell (michael@cs.mun.ca). The
+The current maintainer is Michael Rendell (michael@cs.mun.ca).
+The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
-.\" $OpenBSD: sh.1tbl,v 1.16 1999/07/05 19:50:53 aaron Exp $
+.\" $OpenBSD: sh.1tbl,v 1.17 2000/03/17 18:15:16 aaron Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
nor the
.Fl s
option is specified, the first non-option argument specifies the name
-of a file the shell reads commands from. If there are no non-option
-arguments, the shell reads commands from the standard input. The name of
+of a file the shell reads commands from.
+If there are no non-option
+arguments, the shell reads commands from the standard input.
+The name of
the shell (i.e., the contents of $0) is determined as follows: if the
.Fl c
option is used and there is a non-option argument, it is used as the name;
if the
.Fl i
option is used or if both standard input and standard error are attached
-to a tty. An interactive shell has job control enabled (if available),
-ignores the
+to a tty.
+An interactive shell has job control enabled (if available), ignores the
.Dv SIGINT ,
.Dv SIGQUIT ,
and
.Pa $HOME/.profile
nor the
.Ev ENV
-parameter (see below). Instead, the file
+parameter (see below).
+Instead, the file
.Pa /etc/suid_profile
-is processed. Clearing the privileged option causes the shell to set
+is processed.
+Clearing the privileged option causes the shell to set
its effective user ID (group ID) to its real user ID (group ID).
.Pp
If the basename of the name the shell is called with (i.e., argv[0])
command, arithmetic, and tilde
.Pq Sq \&~
substitution and the resulting file
-(if any) is read and executed. If the
+(if any) is read and executed.
+If the
.Ev ENV
parameter is not set (and not
.Dv NULL )
.Pp
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,
+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
command is executed.
.Ss Command syntax
.Ql \&)
.Pc .
Aside from delimiting words, spaces and tabs are ignored, while newlines
-usually delimit commands. The meta-characters are used in building the
-following tokens:
+usually delimit commands.
+The meta-characters are used in building the following tokens:
.Ql < ,
.Ql <& ,
.Ql << ,
.Pq Sq \&"
or single
.Pq Sq \&'
-quotes. Note that the following characters are also treated specially by the
+quotes.
+Note that the following characters are also treated specially by the
shell and must be quoted if they are to represent themselves:
.Ql \e ,
.Ql \&" ,
.Sx Input/output redirections
below),
and command words; the only restriction is that parameter assignments come
-before any command words. The command words, if any, define the command
-that is to be executed and its arguments. The command may be a shell built-in
+before any command words.
+The command words, if any, define the command
+that is to be executed and its arguments.
+The command may be a shell built-in
command, a function or an external command (i.e., a separate executable file
that is located using the
.Ev PATH
be executed, the exit status is 126); the exit status of other command
constructs (built-in commands, functions, compound-commands, pipelines, lists,
etc.) are all well-defined and are described where the construct is
-described. The exit status of a command consisting only of parameter
+described.
+The exit status of a command consisting only of parameter
assignments is that of the last command substitution performed during the
parameter assignment or 0 is there were no command substitutions.
.Pp
token to form pipelines, in which the standard output of each command but the
last is piped (see
.Xr pipe 2 )
-to the standard input of the following command. The exit status of a pipeline
-is that of its last command. A pipeline may be prefixed by the
+to the standard input of the following command.
+The exit status of a pipeline is that of its last command.
+A pipeline may be prefixed by the
.Ql !
reversed word which causes the exit status of the pipeline to be logically
complemented: if the original status was 0 the complemented status will be 1;
.Ql &&
and
.Ql ||
-have equal precedence which is higher that that of
+have equal precedence which is higher than that of
.Ql & ,
.Ql |&
and
.Ql \&; ,
-which also have equal precedence. The
+which also have equal precedence.
+The
.Ql &
token causes the preceding command to be executed asynchronously; that is,
the shell starts the command but does not wait for it to complete (the shell
does keep track of the status of asynchronous commands, see
.Sx Job control
-below). When an asynchronous command is started when job control is disabled
+below).
+When an asynchronous command is started when job control is disabled
(i.e., in most scripts), the command is started with signals
.Dv SIGINT
and
The exit status of a list is that of the last command executed, with the
exception of asynchronous lists, for which the exit status is 0.
.Pp
-Compound commands are created using the following reserved words. These words
+Compound commands are created using the following reserved words.
+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):
.Sy Note:
Some shells (but not this one) execute control structure commands in a
subshell when one or more of their file descriptors are redirected, so any
-environment changes inside them may fail. To be portable, the
+environment changes inside them may fail.
+To be portable, the
.Ic exec
statement should be used instead to redirect file descriptors before the
control structure.
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
-a (syntactically correct) reserved word. For example,
+a (syntactically correct) reserved word.
+For example,
.Pp
.Bl -inset -indent -compact
.It Ic { echo foo; echo bar; }
.It Ic \&( Ar list Ic \&)
Execute
.Ar list
-in a subshell. There is no implicit way to pass environment changes from a
+in a subshell.
+There is no implicit way to pass environment changes from a
subshell back to its parent.
.It Ic \&{ Ar list Ic \&}
Compound construct;
.Ar list
-is executed, but not in a subshell. Note that
+is executed, but not in a subshell.
+Note that
.Ic \&{
and
.Ic \&}
.Ar pattern Ns s ;
the
.Ar list
-associated with the first successfully matched pattern is executed. Patterns
-used in
+associated with the first successfully matched pattern is executed.
+Patterns used in
.Ic case
statements are the same as those used for file name patterns except that the
restrictions regarding
.Ql \&.
and
.Ql /
-are dropped. Note that any unquoted space before and after a pattern is
-stripped; any space with a pattern must be quoted. Both the word and the
+are dropped.
+Note that any unquoted space before and after a pattern is
+stripped; any space with a pattern must be quoted.
+Both the word and the
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
+well as tilde substitution.
+For historical reasons, open and close braces may be used instead of
.Ic in
and
.Ic esac
.Ar name
is set to the word and
.Ar list
-is executed. If
+is executed.
+If
.Ic in
is not used to specify a word list, the positional parameters ($1, $2, etc.)
-are used instead. For historical reasons, open and close braces may be used
-instead of
+are used instead.
+For historical reasons, open and close braces may be used instead of
.Ic do
and
.Ic done
.Ar list
following the
.Ic elif ,
-if any, is executed with similar consequences. If all the lists following
-the
+if any, is executed with similar consequences.
+If all the lists following the
.Ic if
and
.Ic elif Ns s
.Ar list
following the
.Ic else
-is executed. The exit status of an
+is executed.
+The exit status of an
.Ic if
statement is that of non-conditional
.Ar list
.Xc
A
.Ic while
-is a pre-checked loop. Its body is executed as often as the exit status of
-the first
+is a pre-checked loop.
+Its body is executed as often as the exit status of the first
.Ar list
-is zero. The exit status of a
+is zero.
+The exit status of a
.Ic while
statement is the last exit status of the
.Ar list
.Ar name
(see
.Sx Functions
-below). Note that redirections specified after a function definition are
+below).
+Note that redirections specified after a function definition are
performed whenever the function is executed, not when the function definition
is executed.
.It Ar name Ic () Ar command
.El
.Ss Quoting
Quoting is used to prevent the shell from treating characters or words
-specially. There are three methods of quoting. First,
+specially.
+There are three methods of quoting.
+First,
.Ql \e
quotes the following character, unless it is at the end of a line, in which
case both the
.Ql \e
-and the newline are stripped. Second, a single quote
+and the newline are stripped.
+Second, a single quote
.Pq Sq '
-quotes everything up to the next single quote (this may span lines). Third,
-a double quote
+quotes everything up to the next single quote (this may span lines).
+Third, a double quote
.Pq Sq \&"
quotes all characters, except
.Ql $ ,
.Ql `
inside double quotes have their usual meaning (i.e., parameter, command or
arithmetic substitution) except no field splitting is carried out on the
-results of double-quoted substitutions. If a
+results of double-quoted substitutions.
+If a
.Ql \e
inside a double-quoted string is followed by
.Ql \e ,
.Ss Aliases
There are two types of aliases: normal command aliases and tracked aliases.
Command aliases are normally used as a short hand for a long or often used
-command. The shell expands command aliases (i.e., substitutes the alias name
-for its value) when it reads the first word of a command. An expanded alias
-is re-processed to check for more aliases. If a command alias ends in a
-space or tab, the following word is also checked for alias expansion. The
-alias expansion process stops when a word that is not an alias is found, when
-a quoted word is found or when an alias word that is currently being expanded
-is found.
+command.
+The shell expands command aliases (i.e., substitutes the alias name
+for its value) when it reads the first word of a command.
+An expanded alias is re-processed to check for more aliases.
+If a command alias ends in a
+space or tab, the following word is also checked for alias expansion.
+The alias expansion process stops when a word that is not an alias is found,
+when a quoted word is found or when an alias word that is currently being
+expanded is found.
.Pp
The following command aliases are defined automatically by the shell:
.Pp
.El
.Pp
Tracked aliases allow the shell to remember where it found a particular
-command. 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
+command.
+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. Tracked aliases
-can be listed and created using
+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
.Ev PATH
-parameter clears the saved paths for all tracked aliases. If the
+parameter clears the saved paths for all tracked aliases.
+If the
.Ic trackall
option is set (i.e.,
.Ic set Fl o Ic trackall
or
.Ic set Fl h ) ,
-the shell tracks all commands. This option is set automatically for
-non-interactive shells. For interactive shells, only the following commands are
+the shell tracks all commands.
+This option is set automatically for non-interactive shells.
+For interactive shells, only the following commands are
automatically tracked:
.Ic cat , cc , chmod , cp ,
.Ic date , ed , emacs , grep ,
.Ic who .
.Ss Substitution
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. Parameter substitutions,
+substitutions on the words of the command.
+There are three kinds of
+substitution: parameter, command, and arithmetic.
+Parameter substitutions,
which are described in detail in the next section, take the form
-.Ic $name
+.Ic $ Ns Ar name
or
-.Ic ${...} ;
+.Ic ${ Ns Ar ... Ns Ic \&} ;
command substitutions take the form
-.Ic $( Ns Ar command Ns Ic )
+.Ic $( Ns Ar command Ns Ic \&)
or
.Ic ` Ns Ar command Ns Ic ` ;
and arithmetic substitutions take the form
substitution are generally subject to word or field splitting according to
the current value of the
.Ev IFS
-parameter. The
+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
whitespace characters, in combination with zero or no
.Pf non- Ev IFS
whitespace
-characters, delimit a field. As a special case, leading and trailing
+characters, delimit a field.
+As a special case, leading and trailing
.Ev IFS
whitespace is stripped (i.e., no leading or trailing empty field is created by
it); leading or trailing
value of space, tab, and newline is used.
.Pp
Also, note that the field splitting applies only to the immediate result of
-the substitution. Using the previous example, the substitution for $VAR:E
+the substitution.
+Using the previous example, the substitution for $VAR:E
results in the fields:
.Dq A ,
.Dq B ,
brace expansion and file name expansion (see the relevant sections below).
.Pp
A command substitution is replaced by the output generated by the specified
-command, which is run in a subshell. For
-.Ic $( Ns Ar command Ns Ic )
+command, which is run in a subshell.
+For
+.Ic $( Ns Ar command Ns Ic \&)
substitutions, normal quoting rules are used when
.Ar command
is parsed; however, for the
.Ql \e
is stripped (a
.Ql \e
-followed by any other character is unchanged). As a special case in command
-substitutions, a command of the form
+followed by any other character is unchanged).
+As a special case in command substitutions, a command of the form
.Ic \&< Ar file
is interpreted to mean substitute the contents of
.Ar file
.Sy Note:
.Ic $( Ns Ar command Ns Ic \&)
expressions are currently parsed by finding the matching parenthesis,
-regardless of quoting. This should be fixed soon.
+regardless of quoting.
+This should be fixed soon.
.Pp
Arithmetic substitutions are replaced by the value of the specified expression.
For example, the command
.Ic echo $((2+3*4))
-prints 14. See
+prints 14.
+See
.Sx Arithmetic expressions
for a description of an expression.
.Ss Parameters
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
+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
.Po
.Ic ${ Ns Ar name Ns Ic \&} ,
where
.Ar name
-is a parameter name. If substitution is performed on a parameter that is not
-set, a
-.Dv NULL
-string is substituted unless the
+is a parameter name.
+If substitution is performed on a parameter that is not set, a
+null string is substituted unless the
.Ic nounset
option
.Po
.Pc
is set, in which case an error occurs.
.Pp
-Parameters can be assigned valued in a number of ways. First, the shell
-implicitly sets some parameters like
+Parameters can be assigned valued in a number of ways.
+First, the shell implicitly sets some parameters like
.Ic # , PWD ,
etc.; this is the only way the special single character parameters are set.
-Second, parameters are imported from the shell's environment at startup. Third,
-parameters can be assigned values on the command line, for example,
+Second, parameters are imported from the shell's environment at startup.
+Third, parameters can be assigned values on the command line, for example,
.Ic FOO=bar
sets the parameter
.Ev FOO
multiple parameter assignments can be given on a single command line and they
can be followed by a simple-command, in which case the assignments are in
effect only for the duration of the command (such assignments are also
-exported, see below for implications of this). Note that both the parameter
-name and the
+exported, see below for implications of this).
+Note that both the parameter name and the
.Ql =
-must be unquoted for the shell to recognize a parameter assignment. The fourth
-way of setting a parameter is with the
+must be unquoted for the shell to recognize a parameter assignment.
+The fourth way of setting a parameter is with the
.Ic export ,
.Ic readonly
and
.Ic typeset
commands; see their descriptions in the
.Sx Command execution
-section. Fifth,
+section.
+Fifth,
.Ic for
loops set parameters as well as the
.Ic getopts ,
.Ic read
and
.Ic set Fl A
-commands. Lastly, parameters can be assigned values using assignment operators
+commands.
+Lastly, parameters can be assigned values using assignment operators
inside arithmetic expressions (see
.Sx Arithmetic expressions
below) or using the
.Xr environ 5 )
of commands run by the shell as
.Ar name Ns No = Ns Ar value
-pairs. The order in which parameters appear in the environment of a command is
-unspecified. When the shell starts up, it extracts parameters and their values
+pairs.
+The order in which parameters appear in the environment of a command is
+unspecified.
+When the shell starts up, it extracts parameters and their values
from its environment and automatically sets the export attribute for those
parameters.
.Pp
is printed on standard error (preceded by
.Ar name Ns No \&: )
and an error occurs (normally causing termination of a shell script, function
-or .-script). If word is omitted the string
+or .-script).
+If word is omitted the string
.Dq parameter null or not set
is used instead.
.El
.Ar pattern
matches the beginning of the value of parameter
.Ar name ,
-the matched text is deleted from the result of substitution. A single
+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.
set directly using assignments:
.Bl -tag -width "1 ... 9"
.It Ev \&!
-Process ID of the last background process started. If no background processes
-have been started, the parameter is not set.
+Process ID of the last background process started.
+If no background processes have been started, the parameter is not set.
.It Ev \&#
The number of positional parameters (i.e., $1, $2, etc.).
.It Ev \&$
.Ic set
command below for list of options).
.It Ev \&?
-The exit status of the last non-asynchronous command executed. If the last
-command was killed by a signal,
+The exit status of the last non-asynchronous command executed.
+If the last command was killed by a signal,
.Ic \&$\&?
is set to 128 plus the signal number.
.It Ev 0
.Ar command-name
was supplied, or the
.Ar file
-argument, if it was supplied. If the
+argument, if it was supplied.
+If the
.Ic posix
option is not set,
.Ic \&$0
is the name of the current function or script.
.It Ev 1 ... Ev 9
The first nine positional parameters that were supplied to the shell, function
-or .-script. Further positional parameters may be accessed using
+or .-script.
+Further positional parameters may be accessed using
.Ic ${ Ns Ar number Ns Ic \&} .
.It Ev \&*
-All positional parameters (except parameter 0), i.e., $1, $2, $3... If used
+All positional parameters (except parameter 0), i.e., $1, $2, $3...
+If used
outside of double quotes, parameters are separate words (which are subjected
to word splitting); if used within double quotes, parameters are separated
by the first character of the
Same as
.Ic \&$\&* ,
unless it is used inside double quotes, in which case a separate word is
-generated for each positional parameter. If there are no positional parameters,
-no word is generated.
+generated for each positional parameter.
+If there are no positional parameters, no word is generated.
.Ic \&$\&@
can be used to access arguments, verbatim, without losing
.Dv NULL
.It Ev CDPATH
Search path for the
.Ic cd
-built-in command. Works the same way as
+built-in command.
+Works the same way as
.Ev PATH
for those directories not beginning with
.Ql /
in
.Ic cd
-commands. Note that if
+commands.
+Note that if
.Ev CDPATH
is set and does not contain
.Dq \&.
-or contains an empty path, the current directory is not searched. Also, the
+or contains an empty path, the current directory is not searched.
+Also, the
.Ic cd
built-in command will display the resulting directory when a match is found
in any search path other than the empty path.
.It Ev COLUMNS
-Set to the number of columns on the terminal or window. Currently set to the
+Set to the number of columns on the terminal or window.
+Currently set to the
.Dq cols
value as reported by
.Xr stty 1
-if that value is non-zero. This parameter is used by
+if that value is non-zero.
+This parameter is used by
.Ic set Fl o
and
.Ic kill -l
commands to format information columns.
.It Ev ENV
If this parameter is found to be set after any profile files are executed, the
-expanded value is used as a shell startup file. It typically contains function
-and alias definitions.
+expanded value is used as a shell startup file.
+It typically contains function and alias definitions.
.It Ev ERRNO
Integer value of the shell's
.Va errno
-variable. It indicates the reason the last system call failed. Not yet
-implemented.
+variable.
+It indicates the reason the last system call failed.
+Not yet implemented.
.It Ev EXECSHELL
If set, this parameter is assumed to contain the shell that is to be used to
execute commands that
Like
.Ev PATH ,
but used when an undefined function is executed to locate the file defining the
-function. It is also searched when a command can't be found using
+function.
+It is also searched when a command can't be found using
.Ev PATH .
See
.Sx Functions
Internal field separator, used during substitution and by the
.Ic read
command, to split values into distinct arguments; normally set to space, tab
-and newline. See
+and newline.
+See
.Sx Substitution
above for details.
.Pp
The line number of the function or shell script that is currently being
executed.
.It Ev LINES
-Set to the number of lines on the terminal or window. Not yet implemented.
+Set to the number of lines on the terminal or window.
+Not yet implemented.
.It Ev OLDPWD
-The previous working directory. Unset if
+The previous working directory.
+Unset if
.Ic cd
has not successfully changed directories since the shell started, or if the
shell doesn't know where it is.
to process arguments from the beginning the next time it is invoked.
.It Ev PATH
A colon separated list of directories that are searched when looking for
-commands and .'d files. An empty string resulting from a leading or trailing
+commands and .'d files.
+An empty string resulting from a leading or trailing
colon, or two adjacent colons, is treated as a
.Dq \&. ,
the current directory.
.It Ev POSIXLY_CORRECT
If set, this parameter causes the
.Ic posix
-option to be enabled. See
+option to be enabled.
+See
.Sx POSIX mode
below.
.It Ev PPID
.It Ev PS4
Used to prefix commands that are printed during execution tracing (see
.Ic set Fl x
-command below). The prompt is printed verbatim (i.e., no substitutions are
-done). Default is
+command below).
+The prompt is printed verbatim (i.e., no substitutions are done).
+Default is
.Dq \&+\ \& .
.It Ev PWD
-The current working directory. May be unset or
+The current working directory.
+May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev REPLY
.Ic read
command if no names are given.
.It Ev TMPDIR
-The directory shell temporary files are created in. If this parameter is not
+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
files are created in
.Pa /tmp .
.Ql ~ .
The characters following the tilde, up to the first
.Ql / ,
-if any, are assumed to be a login name. If the login name is empty,
+if any, are assumed to be a login name.
+If the login name is empty,
.Ql +
or
.Ql - ,
.Ev PWD ,
or
.Ev OLDPWD
-parameter is substituted, respectively. Otherwise, the password file is
+parameter is substituted, respectively.
+Otherwise, the password file is
searched for the login name, and the tilde expression is substituted with the
-user's home directory. If the login name is not found in the password file or
+user's home directory.
+If the login name is not found in the password file or
if any quoting or parameter substitution occurs in the login name, no
substitution is performed.
.Pp
.Ql *
characters or
.Dq [..]
-sequences. Once brace expansion has been performed, the shell replaces file
+sequences.
+Once brace expansion has been performed, the shell replaces file
name patterns with the sorted named of all the files that match the pattern
-(if no files match, the word is left unchanged). The pattern elements have the
-following meaning:
+(if no files match, the word is left unchanged).
+The pattern elements have the following meaning:
.Bl -tag -width Ds
.It Ic \&?
Matches any single character.
.It Ic \&*
Matches any sequence of characters.
.It Ic \&[ Ns No .. Ns Ic \&]
-Matches any of the characters inside the brackets. Ranges of characters can be
+Matches any of the characters inside the brackets.
+Ranges of characters can be
specified by separating two characters by a
.Ql -
(e.g.,
.Dq [a0-9]
matches the letter
.Dq a
-or any digit). In order to represent itself, a
+or any digit).
+In order to represent itself, a
.Ql -
must either be quoted or the first or last character in the character list.
Similarly, a
.Ql \&]
must be quoted or the first character in the list if it is to represent itself
-instead of the end of the list. Also, a
+instead of the end of the list.
+Also, a
.Ql !
appearing at the start of the list has special meaning (see below), so to
represent itself it must be quoted or appear later in the list.
.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
-the shell. Three exceptions to this are commands in pipelines, for which
+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,
asynchronous commands created when job control is disabled, for which standard
input is initially set to be from
.Ar file
does not exist, it is created; if it does exist, is a regular file and the
.Ic noclobber
-option is set, an error occurs; otherwise, the file is truncated. Note that this
-means the command
+option is set, an error occurs; otherwise, the file is truncated.
+Note that this means the command
.Ic cmd < foo > foo
will open
.Ar foo
.Ic \&> ,
except if
.Ar file
-exists it is appended to instead of being truncated. Also, the file is opened
+exists it is appended to instead of being truncated.
+Also, the file is opened
in append mode, so writes always go to the end of the file (see
.Fn open 2 ) .
.It Ic \&< Ar file
the shell copies lines from the command source into a temporary file until a
line matching
.Ar marker
-is read. When the command is executed, standard input is redirected from the
-temporary file. If
+is read.
+When the command is executed, standard input is redirected from the
+temporary file.
+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
.Ql ` ,
.Ql \e ,
and
-.Dq \enewline .
+.Ql \enewline .
If multiple here documents are used on the same command line, they are saved in
order.
.It Ic \&<\&<\&- Ar marker
.Pp
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
+redirection with a single digit.
+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
and
.Ar fd
-arguments of redirections. Note, however, that the results of any file name
+arguments of redirections.
+Note, however, that the results of any file name
generation are only used if a single file is matched; if multiple files match,
-the word with the expanded file name generation characters is used. Note
+the word with the expanded file name generation characters is used.
+Note
that in restricted shells, redirections which can create files cannot be used.
.Pp
For simple-commands, redirections may appear anywhere in the command; for
.Ic if
statements, etc.
.Pc ,
-any redirections must appear at the end. Redirections are processed after
+any redirections must appear at the end.
+Redirections are processed after
pipelines are created and in the order they are given, so
.Pp
.Ic cat /foo/bar 2\&>&1 \&> /dev/null \&| cat -n
.Tn NOT .
.It Ic \&+\&+
Increment; must be applied to a parameter (not a literal or other expression).
-The parameter is incremented by 1. When used as a prefix operator, the result
+The parameter is incremented by 1.
+When used as a prefix operator, the result
is the incremented value of the parameter; when used as a postfix operator, the
result is the original value of the parameter.
.It Ic \&-\&-
except the parameter is decremented by 1.
.It Ic \&,
Separates two arithmetic expressions; the left-hand side is evaluated first,
-then the right. The result is the value of the expression on the right-hand
-side.
+then the right.
+The result is the value of the expression on the right-hand side.
.It Ic =
Assignment; variable on the left is set to the value on the right.
.It Xo Ic \&*= /= \&+= \&-= \&<\&<=
.It Ic \&|\&|
Logical
.Tn OR ;
-the result is 1 if either argument is non-zero, 0 if not. The right
-argument is evaluated only if the left argument is zero.
+the result is 1 if either argument is non-zero, 0 if not.
+The right argument is evaluated only if the left argument is zero.
.It Ic \&&\&&
Logical
.Tn AND ;
-the result is 1 if both arguments are non-zero, 0 if not. The
-right argument is evaluated only if the left argument is non-zero.
+the result is 1 if both arguments are non-zero, 0 if not.
+The right argument is evaluated only if the left argument is non-zero.
.It Ic \&|
Arithmetic (bit-wise)
.Tn OR .
Less than; the result is 1 if the left argument is less than the right, 0 if
not.
.It Ic \&<= \&>= \&>
-Less than or equal, greater than or equal, greater than. See
+Less than or equal, greater than or equal, greater than.
+See
.Ic \&< .
.It Ic \&<\&< \&>\&>
Shift left (right); the result is the left argument with its bits shifted left
Addition, subtraction, multiplication, and division.
.It Ic %
Remainder; the result is the remainder of the division of the left argument by
-the right. The sign of the result is unspecified if either argument is
-negative.
+the right.
+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
.Ic function Ar name
syntax or the Bourne/POSIX shell
.Fn name
-syntax (see below for the difference between the two forms). Functions are like
+syntax (see below for the difference between the two forms).
+Functions are like
.Li .-scripts
-in that they are executed in the current environment. However, unlike
+in that they are executed in the current environment.
+However, unlike
.Li .-scripts ,
shell arguments (i.e., positional parameters $1, $2, etc.) are never visible
-inside them. When the shell is determining the location of a command, functions
+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
.Ev PATH
executed, the shell searches the path specified in the
.Ev FPATH
parameter for a file with the same name as the function, which, if found, is
-read and executed. If after executing the file the named function is found to
+read and executed.
+If after executing the file the named function is found to
be defined, the function is executed; otherwise, the normal command search is
continued (i.e., the shell searches the regular built-in command table and
.Ev PATH ) .
.Ic typeset \&-ft
and
.Ic typeset \&-fx ,
-respectively. When a traced function is executed, the shell's
+respectively.
+When a traced function is executed, the shell's
.Ic xtrace
option is turned on for the function's duration; otherwise, the
.Ic xtrace
-option is turned off. The
+option is turned off.
+The
.Dq export
-attribute of functions is currently not used. In the original Korn shell,
+attribute of functions is currently not used.
+In the original Korn shell,
exported functions are visible to shell scripts that are executed.
.Pp
Since functions are executed in the current shell environment, parameter
assignments made inside functions are visible after the function completes.
If this is not the desired effect, the
.Ic typeset
-command can be used inside a function to create a local parameter. Note that
-special parameters (e.g., $$, $\&!) can't be scoped in this way.
+command can be used inside a function to create a local parameter.
+Note that special parameters (e.g., $$, $\&!) can't be scoped in this way.
.Pp
The exit status of a function is that of the last command executed in the
-function. A function can be made to finish immediately using the
+function.
+A function can be made to finish immediately using the
.Ic return
command; this may also be used to explicitly specify the exit status.
.Pp
.Ic getopts
inside a function interferes with using
.Ic getopts
-outside the function). In the future, the following differences will also be
-added:
+outside the function).
+In the future, the following differences will also be added:
.Bl -bullet -offset indent
.It
A separate trap/signal environment will be used during the execution of
-functions. This will mean that traps set inside a function will not affect the
+functions.
+This will mean that traps set inside a function will not affect the
shell's traps and signals that are not ignored in the shell (but may be
trapped) will have their default effect in a function.
.It
compliant; however, in some cases,
.Tn POSIX
behaviour is contrary either to the original Korn shell behaviour or to user
-convenience. How the shell behaves in these cases is determined by the state
-of the
+convenience.
+How the shell behaves in these cases is determined by the state of the
.Ic posix
option
.Pq Ic set Fl o Ic posix .
If it is on, the
.Tn POSIX
-behaviour is followed; otherwise, it is not. The
+behaviour is followed; otherwise, it is not.
+The
.Ic posix
option is set automatically when the shell starts up if the environment
contains the
.Ic \e\&"
inside double quoted
.Ic `\&.\&.`
-command substitutions. In
+command substitutions.
+In
.Tn POSIX
mode, the
.Ic \e\&"
is interpreted when the command is interpreted; in
.Pf non- Tn POSIX
mode, the
-backslash is stripped before the command substitution is interpreted. For
-example,
+backslash is stripped before the command substitution is interpreted.
+For example,
.Ic echo \&"`echo \e\&"hi\e\&"`\&"
produces
.Dq \&"hi\&"
.Dq hi
in
.Pf non- Tn POSIX
-mode. To avoid problems, use the
+mode.
+To avoid problems, use the
.Ic $(...)
form of command substitution.
.It
.Ic kill -l
-output. In
+output.
+In
.Tn POSIX
mode, signal names are listed one per line; in
.Pf non- Tn POSIX
mode,
-signal numbers, names and descriptions are printed in columns. In future, a new
-option
+signal numbers, names and descriptions are printed in columns.
+In future, a new option
.Po Fl v
\ perhaps
.Pc
will be added to distinguish the two behaviours.
.It
.Ic fg
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status is 0 if no errors occur; in
.Pf non- Tn POSIX
or
.Ql + .
.It
-Brace expansion (also known as alternation). In
+Brace expansion (also known as alternation).
+In
.Tn POSIX
mode, brace expansion is
disabled; in
.Pf non- Tn POSIX
-mode, brace expansion is enabled. Note that
+mode, brace expansion is enabled.
+Note that
.Ic set Fl o Ic posix
(or setting the
.Ev POSIXLY_CORRECT
parameter) automatically turns the
.Ic braceexpand
-option off, although it can be explicitly turned on later.
+option off; however, it can be explicitly turned on later.
.It
.Ic set \&- .
In
mode, it does.
.It
.Ic set
-exit status. In
+exit status.
+In
.Tn POSIX
mode, the exit status of
.Ic set
mode, the exit status is that of any
command substitutions performed in generating the
.Ic set
-command. For example,
+command.
+For example,
.Ic set \&-\&- `false`; echo $?
prints 0 in
.Tn POSIX
mode, 1 in
.Pf non- Tn POSIX
-mode. This construct is used in most shell scripts that use the old
+mode.
+This construct is used in most shell scripts that use the old
.Xr getopt 1
command.
.It
.Ic readonly ,
and
.Ic typeset
-commands. In
+commands.
+In
.Tn POSIX
mode, normal argument expansion is done; in
.Pf non- Tn POSIX
field splitting, file globbing, brace expansion, and (normal) tilde expansion
are turned off, while assignment tilde expansion is turned on.
.It
-Signal specification. In
+Signal specification.
+In
.Tn POSIX
mode, signals can be specified as digits, only
if signal numbers match
.Pf non- Tn POSIX
mode, signals can always be digits.
.It
-Alias expansion. In
+Alias expansion.
+In
.Tn POSIX
mode, alias expansion is only carried out when
reading command words; in
.Pf non- Tn POSIX
mode, alias expansion is carried out on any
-word following an alias that ended in a space. For example, the following
+word following an alias that ended in a space.
+For example, the following
.Ic for
loop
.Pp
.Pf non- Tn POSIX
mode.
.It
-Test. In
+Test.
+In
.Tn POSIX
mode, the expression
.Ql Fl t
.El
.Ss Command execution
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
.Ev PATH
-parameter. The checks are made in the above order. Special built-in commands
-differ from other commands in that the
+parameter.
+The checks are made in the above order.
+Special built-in commands differ from other commands in that the
.Ev PATH
parameter is not used to find them, and an error during their execution can
cause a non-interactive shell to exit and parameter assignments that are
-specified before the command are kept after the command completes. Just to
-confuse things, if the
+specified before the command are kept after the command completes.
+Just to confuse things, if the
.Ic posix
option is turned off (see
.Ic set
command below), some special commands are very special in that no field
splitting, file globbing, brace expansion, nor tilde expansion is performed
-on arguments that look like assignments. Regular built-in commands are
-different only in that the
+on arguments that look like assignments.
+Regular built-in commands are different only in that the
.Ev PATH
parameter is not used to find them.
.Pp
-The original ksh and
+The original
+.Nm ksh
+and
.Tn POSIX
differ somewhat in which commands are considered
special or regular:
.It Ic \&. Ar file Op Ar arg1 ...
Execute the commands in
.Ar file
-in the current environment. The file is searched for in the directories of
+in the current environment.
+The file is searched for in the directories of
.Ev PATH .
If arguments are given, the positional parameters may be used to access them
while
.Ar file
-is being executed. If no arguments are given, the positional parameters are
+is being executed.
+If no arguments are given, the positional parameters are
those of the environment the command is used in.
.It Ic \&: Op Ar ...
-The null command. Exit status is set to zero.
+The null command.
+Exit status is set to zero.
.It Xo Ic alias
.Op Fl d | Ic +-t Op Fl r
.Op Ic +-px
.Xc
Without arguments,
.Ic alias
-lists all aliases. For any name without a value, the existing alias is listed.
+lists all aliases.
+For any name without a value, the existing alias is listed.
Any name with a value defines an alias (see
.Sx Aliases
above).
.Pp
-When listing aliases, one of two formats is used. Normally, aliases are listed
-as
+When listing aliases, one of two formats is used.
+Normally, aliases are listed as
.Ar name Ns No = Ar value ,
where
.Ar value
-is quoted. If options were preceded with
+is quoted.
+If options were preceded with
.Ql + ,
-or a lone \&+ is given on the command line, only
+or a lone
+.Ql +
+is given on the command line, only
.Ar name
-is printed. In addition, if the
+is printed.
+In addition, if the
.Fl p
option is used, each alias is prefixed with the string
.Dq alias\ \& .
The
.Fl t
option indicates that tracked aliases are to be listed/set (values specified on
-the command line are ignored for tracked aliases). The
+the command line are ignored for tracked aliases).
+The
.Fl r
option indicates that all tracked aliases are to be reset.
.Pp
.Sx Tilde expansion
above).
.It Ic bg Op Ar job ...
-Resume the specified stopped job(s) in the background. If no jobs are
-specified,
+Resume the specified stopped job(s) in the background.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+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
.Ar dir .
A
.Dv NULL
-path means the current directory. If
+path means the current directory.
+If
.Ar dir
is found in any component of the
.Ev CDPATH
.Ar dir
is missing, the home directory
.Ev HOME
-is used. If
+is used.
+If
.Ar dir
is
.Ql - ,
the previous working directory is used (see
.Ev OLDPWD
-parameter). If the
+parameter).
+If the
.Fl L
option (logical path) is used or if the
.Ic physical
.Dq \&.\&.
in
.Ar dir
-are relative to the path used to get to the directory. If the
+are relative to the path used to get to the directory.
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
option is set,
.Dq \&.\&.
-is relative to the filesystem directory tree. The
+is relative to the filesystem directory tree.
+The
.Ev PWD
and
.Ev OLDPWD
.Ar cmd
is executed exactly as if
.Ic command
-had not been specified, with two exceptions. First,
+had not been specified, with two exceptions.
+First,
.Ar cmd
cannot be a shell function, and second, special built-in commands lose their
specialness (i.e., redirection and utility errors do not cause the shell to
-exit, and command assignments are not permanent). If the
+exit, and command assignments are not permanent).
+If the
.Fl p
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 POSIXish
+(the actual value of the default path is system dependent: on POSIXish
systems, it is the value returned by
.Ic getconf CS_PATH ) .
.It Ic continue Op Ar level
.Op Ar arg ...
.Xc
Prints its arguments (separated by spaces) followed by a newline, to the
-standard output. The newline is suppressed if any of the arguments contain the
+standard output.
+The newline is suppressed if any of the arguments contain the
backslash sequence
.Ql \ec .
See the
.Pp
The options are provided for compatibility with
.Bx
-shell scripts. The
+shell scripts.
+The
.Fl n
option suppresses the trailing newline,
.Fl e
.Pp
If no command is given except for I/O redirection, the I/O redirection is
permanent and the shell is
-not replaced. Any file descriptors which are opened or
+not replaced.
+Any file descriptors which are opened or
.Xr dup 2 Ns No 'd
in this way are made available to other executed commands (note that the Korn
shell differs here: it does not pass on file descriptors greater than 2).
.It Ic exit Op Ar status
-The shell exits with the specified exit status. If
+The shell exits with the specified exit status.
+If
.Ar status
is not specified, the exit status is the current value of the
.Ic \&?
.It Xo Ic export Op Fl p
.Op Ar parameter Ns Op \&= Ns Ar value
.Xc
-Sets the export attribute of the named parameters. Exported parameters are
-passed in the environment to executed commands. If values are specified, the
-named parameters are also assigned.
+Sets the export attribute of the named parameters.
+Exported parameters are passed in the environment to executed commands.
+If values are specified, the named parameters are also assigned.
.Pp
If no parameters are specified, the names of all parameters with the export
attribute are printed one per line, unless the
This command is usually accessed with the predefined
.Ic alias r='fx -e -' .
.It Ic fg Op Ar job ...
-Resume the specified job(s) in the foreground. If no jobs are specified,
+Resume the specified job(s) in the foreground.
+If no jobs are specified,
.Ic %\&+
-is assumed. This command is only available on systems which support job
-control (see
+is assumed.
+This command is only available on systems which support job control (see
.Sx Job control
below for more information).
.It Xo Ic getopts Ar optstring name
.Ar optstring
contains the option letters that
.Ic getopts
-is to recognize. If a letter is followed by a colon, the option is expected to
-have an argument. Options that do not take arguments may be grouped in a single
-argument. If an option takes an argument and the option character is not the
+is to recognize.
+If a letter is followed by a colon, the option is expected to
+have an argument.
+Options that do not take arguments may be grouped in a single argument.
+If an option takes an argument and the option character is not the
last character of the argument it is found in, the remainder of the argument is
taken to be the option's argument; otherwise, the next argument is the option's
argument.
.Ar name
(indicating an illegal option or missing argument, respectively) and
.Ev OPTAG
-is set to the option character that caused the problem. An error message is
-also printed to standard error if
+is set to the option character that caused the problem.
+An error message is also printed to standard error if
.Ar optstring
does not being with a colon.
.Pp
When the end of the options is encountered,
.Ic getopts
-exits with a non-zero exit status. Options end at the first (non-option
+exits with a non-zero exit status.
+Options end at the first (non-option
argument) argument that does not start with a
.Ql - ,
or when a
.It Xo Ic hash Op Fl r
.Op Ar name ...
.Xc
-Without arguments, any hashed executable command pathnames are listed. The
+Without arguments, any hashed executable command pathnames are listed.
+The
.Fl r
-option causes all hashed commands to be removed from the hash table. Each
+option causes all hashed commands to be removed from the hash table.
+Each
.Ar name
is searched as if it were a command name and added to the hash table if it is
an executable command.
.Op Ar job ...
.Xc
Display information about the specified job(s); if no jobs are specified, all
-jobs are displayed. The
+jobs are displayed.
+The
.Fl n
option causes information to be displayed only for jobs that have changed
-state since the last notification. If the
+state since the last notification.
+If the
.Fl l
-option is used, the process ID of each process in a job is also listed. The
+option is used, the process ID of each process in a job is also listed.
+The
.Fl p
-option causes only the process group of each job to be printed. See
+option causes only the process group of each job to be printed.
+See
.Sx Job control
below for the format of
.Ar job
.Ar pgrp No } Ar ...
.Xc
Send the specified signal to the specified jobs, process IDs, or process
-groups. If no signal is specified, the
+groups.
+If no signal is specified, the
.Dv TERM
-signal is sent. If a job is specified, the signal is sent to the job's
-process group. See
+signal is sent.
+If a job is specified, the signal is sent to the job's process group.
+See
.Sx Job control
below for the format of
.Ar job .
.Xc
.Ic print
prints its arguments on the standard output, separated by spaces and
-terminated with a newline. The
+terminated with a newline.
+The
.Fl n
-option suppresses the newline. By default, certain C escapes are translated.
+option suppresses the newline.
+By default, certain C escapes are translated.
These include
.Ql \eb ,
.Ql \ef ,
.Ql \e
expansion may be inhibited with the
.Fl r
-option. The
+option.
+The
.Fl s
option prints to the history file instead of standard output, the
.Fl u
.Ql \e
sequences unless the
.Fl e
-option is given. As above, the
+option is given.
+As above, the
.Fl n
option suppresses the trailing newline.
.It Ic pwd Op Fl LP
-Print the present working directory. If the
+Print the present working directory.
+If the
.Fl L
option is used or if the
.Ic physical
.Ic set
command below) isn't set, the logical path is printed (i.e., the path used to
.Ic cd
-to the current directory). If the
+to the current directory).
+If the
.Fl P
option (physical path) is used or if the
.Ic physical
.Ev IFS
parameter (see
.Sx Substitution
-above), and assigns each field to the specified parameters. If there are more
-parameters than fields, the extra parameters are set to
+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
-is assigned the remaining fields (inclusive of any separating spaces). If no
-parameters are specified, the
+is assigned the remaining fields (inclusive of any separating spaces).
+If no parameters are specified, the
.Ev REPLY
-parameter is used. If the input line ends in a backslash and the
+parameter is used.
+If the input line ends in a backslash and the
.Fl r
option was not used, the backslash and the newline are stripped and more input
-is read. If no input is read,
+is read.
+If no input is read,
.Ic read
exits with a non-zero status.
.Pp
.Ar n
or the current co-process (see
.Sx Co-processes
-above for comments on this), respectively. If the
+above for comments on this), respectively.
+If the
.Fl s
option is used, input is saved to the history file.
.It Xo Ic readonly Op Fl p
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Sets the read-only attribute of the named parameters. If values are given,
-parameters are set to them before setting the attribute. Once a parameter is
+Sets the read-only attribute of the named parameters.
+If values are given,
+parameters are set to them before setting the attribute.
+Once a parameter is
made read-only, it cannot be unset and its value cannot be changed.
.Pp
If no parameters are specified, the names of all parameters with the read-only
.Ar status .
If no
.Ar status
-is given, the exit status of the last executed command is used. If used
-outside of a function or
+is given, the exit status of the last executed command is used.
+If used outside of a function or
.Ic \&.
script, it has the same effect as
.Ic exit .
All new parameters are created with the export attribute.
.It Fl b Ic notify
Print job notification messages asynchronously, instead of just before the
-prompt. Only used if job control is enabled
+prompt.
+Only used if job control is enabled
.Pq Fl m .
.It Fl C Ic noclobber
Prevent
Exit (after executing the
.Dv ERR
trap) as soon as an error occurs or a command fails (i.e., exits with a
-non-zero status). This does not apply to commands whose exit status is
+non-zero status).
+This does not apply to commands whose exit status is
explicitly tested by a shell construct such as
.Ic if ,
.Ic until ,
.It Fl h Ic trackall
Create tracked aliases for all executed commands (see
.Sx Aliases
-above). Enabled by default for non-interactive shells.
+above).
+Enabled by default for non-interactive shells.
.It Fl i Ic interactive
-Enable interactive mode. This can only be set/unset when the shell is invoked.
+Enable interactive mode.
+This can only be set/unset when the shell is invoked.
.It Fl k Ic keyword
Parameter assignments are recognized anywhere in a command.
.It Fl l Ic login
-The shell is a login shell. This can only be set/unset when the shell is
-invoked (see
+The shell is a login shell.
+This can only be set/unset when the shell is invoked (see
.Sx Shell startup
above).
.It Fl m Ic monitor
Enable job control (default for interactive shells).
.It Fl n lc noexec
-Do not execute any commands. Useful for checking the syntax of scripts
+Do not execute any commands.
+Useful for checking the syntax of scripts
(ignored if interactive).
.It Fl p Ic privileged
Set automatically if, when the shell starts, the read UID or GID does not match
-the effective UID (EUID) or GID (EGID), respectively. See
+the effective UID (EUID) or GID (EGID), respectively.
+See
.Sx Shell startup
above for a description of what this means.
.It Fl r Ic restricted
-Enable restricted mode. This option can only be used when the shell is invoked.
+Enable restricted mode.
+This option can only be used when the shell is invoked.
See
.Sx Shell startup
above for a description of what this means.
.It Fl s Ic stdin
-If used where the shell is invoked, commands are read from standard input. Set
-automatically if the shell is invoked with no arguments.
+If used where the shell is invoked, commands are read from standard input.
+Set automatically if the shell is invoked with no arguments.
.Pp
When
.Fl s
.It Ic nohup
Do not kill running jobs with a
.Dv HUP
-signal when a login shell exists. Currently set by default, but this will
+signal when a login shell exists.
+Currently set by default, but this will
change in the future to be compatible with the original Korn shell (which
doesn't have this option, but does send the
.Dv HUP
signal).
.It Ic nolog
-No effect. In the original Korn shell, this prevents function definitions from
+No effect.
+In the original Korn shell, this prevents function definitions from
being stored in the history file.
.It Ic physical
Causes the
.Dq logical
directories (i.e., the shell handles
.Dq \&.\&. ,
-which allows the user to be oblivious of symbolic links to directories). Clear
-by default. Note that setting this option does not affect the current value of
-the
+which allows the user to be oblivious of symbolic links to directories).
+Clear by default.
+Note that setting this option does not affect the current value of the
.Ev PWD
parameter; only the
.Ic cd
.It Ic posix
Enable
.Tn POSIX
-mode. See
+mode.
+See
.Sx POSIX mode
above.
.It Ic vi
Enable vi-like command-line editing (interactive shells only).
.It Ic viraw
-No effect. In the original Korn shell, unless
+No effect.
+In the original Korn shell, unless
.Ic viraw
was set, the vi command-line mode would let the tty driver do the work until
.Tn ESC
is entered in insert mode.
.El
.Pp
-These options can also be used upon invocation of the shell. The current set of
+These options can also be used upon invocation of the shell.
+The current set of
options (with single letter names) can be found in the parameter
.Dv \&- .
.Ic set Fl o
will print the long names of all options that are currently on.
.Pp
Remaining arguments, if any, are positional parameters and are assigned, in
-order, to the positional parameters (i.e., $1, $2, etc.). If options end with
+order, to the positional parameters (i.e., $1, $2, etc.).
+If options end with
.Ql --
-and there are no remaining arguments, all positional parameters are cleared. If
-no options or arguments are given, the values of all names are printed. For
-unknown historical reasons, a lone
+and there are no remaining arguments, all positional parameters are cleared.
+If no options or arguments are given, the values of all names are printed.
+For unknown historical reasons, a lone
.Ql -
option is treated specially -- it clears both the
.Fl x
evaluates the
.Ar expression
and returns zero status if true, 1 status if false, or greater than 1 if there
-was an error. It is normally used as the condition command of
+was an error.
+It is normally used as the condition command of
.Ic if
and
.Ic while
-statements. The following basic expressions are available:
+statements.
+The following basic expressions are available:
.Bl -tag -width 17n
.It Ar str
.Ar str
-has non-zero length. Note that there is the potential for problems if
+has non-zero length.
+Note that there is the potential for problems if
.Ar str
turns out to be an operator (e.g.,
.Fl r ) .
.Ar option
is set (see
.Ic set
-command above for a list of options). As a non-standard extension, if the
-option starts with a
+command above for a list of options).
+As a non-standard extension, if the option starts with a
.Ql ! ,
the test is negated; the test always fails if
.Ar option
.It Fl t Op Ar fd
File descriptor
.Ar fd
-is a tty device. If the
+is a tty device.
+If the
.Ic posix
option is not set,
.Ar fd
.Ic test
command will attempt to fake it for all tests that operate on files (except the
.Fl e
-test). For example,
+test).
+For example,
.Ic \&[ -w /dev/fd/2 \&]
tests if file descriptor 2 is writable.
.Pp
.Dv ALRM )
or the number of the signal (see
.Ic kill -l
-command above). There are two special signals:
+command above).
+There are two special signals:
.Dv EXIT
(also known as 0), which is executed when the shell is about to exit, and
.Dv ERR ,
.Ic set
command above).
.Dv EXIT
-handlers are executed in the environment of the last executed command. Note
+handlers are executed in the environment of the last executed command.
+Note
that for non-interactive shells, the trap handler cannot be changed for signals
that were ignored when the shell started.
.Pp
.Op Ns = Ns Ar value
.Ar ... Oc
.Xc
-Display or set parameter attributes. With no
+Display or set parameter attributes.
+With no
.Ar name
arguments, parameter attributes are displayed; if no options are used, the
current attributes of all parameters are printed as
.Pq Ic \&-
or cleared
.Pq Ic \&+ .
-Values for parameters may optionally be specified. If
+Values for parameters may optionally be specified.
+If
.Ic typeset
is used inside a function, any newly created parameters are local to the
function.
.Fl f
is used,
.Ic typeset
-operates on the attributes of functions. As with parameters, if no
+operates on the attributes of functions.
+As with parameters, if no
.Ar name Ns s
are given, functions are listed with their values (i.e., definitions) unless
options are introduced with
.It Fl L Ns Ar n
Left justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Leading whitespace (and zeros, if used with the
+assigned value) is used.
+Leading whitespace (and zeros, if used with the
.Fl Z
-option) is stripped. If necessary, values are either truncated or space padded
+option) is stripped.
+If necessary, values are either truncated or space padded
to fit the field width.
.It Fl R Ns Ar n
Right justify attribute.
.Ar n
-specifies the field width. If
+specifies the field width.
+If
.Ar n
is not specified, the current width of a parameter (or the width of its first
-assigned value) is used. Trailing whitespace is stripped. If necessary, values
-are either stripped of leading characters or space padded to make them fit the
-field width.
+assigned value) is used.
+Trailing whitespace is stripped.
+If necessary, values are either stripped of leading characters or space
+padded to make them fit the field width.
.It Fl Z Ns Ar n
Zero fill attribute. If not combined with
.Fl L ,
Integer attribute.
.Ar n
specifies the base to use when displaying the integer (if not specified, the
-base given in the first assignment is used). Parameters with this attribute may
+base given in the first assignment is used).
+Parameters with this attribute may
be assigned values containing arithmetic expressions.
.It Fl U
-Unsigned integer attribute. Integers are printed as unsigned values (only
+Unsigned integer attribute.
+Integers are printed as unsigned values (only
useful when combined with the
.Fl i
-option). This option is not in the original Korn shell.
+option).
+This option is not in the original Korn shell.
.It Fl f
-Function mode. Display or set functions and their attributes, instead of
-parameters.
+Function mode.
+Display or set functions and their attributes, instead of parameters.
.It Fl l
-Lower case attribute. All upper case characters in values are converted to
-lower case. (In the original Korn shell, this parameter meant
+Lower case attribute.
+All upper case characters in values are converted to lower case.
+(In the original Korn shell, this parameter meant
.Dq long integer
when used with the
.Fl i
Print complete
.Ic typeset
commands that can be used to re-create the attributes (but not the values) or
-parameters. This is the default action (option exists for ksh93 compatibility).
+parameters.
+This is the default action (option exists for ksh93 compatibility).
.It Fl r
-Read-only attribute. Parameters with this attribute may not be assigned to or
-unset. Once this attribute is set, it can not be turned off.
+Read-only attribute.
+Parameters with this attribute may not be assigned to or unset.
+Once this attribute is set, it can not be turned off.
.It Fl t
-Tag attribute. Has no meaning to the shell; provided for application use.
+Tag attribute.
+Has no meaning to the shell; provided for application use.
.Pp
For functions,
.Fl t
-is the trace attribute. When functions with the trace attribute are executed,
-the
+is the trace attribute.
+When functions with the trace attribute are executed, the
.Ic xtrace
.Pq Fl x
shell option is temporarily turned on.
.It Fl u
-Upper case attribute. All lower case characters in values are converted to
-upper case. (In the original Korn shell, this parameter meant
+Upper case attribute.
+All lower case characters in values are converted to upper case.
+(In the original Korn shell, this parameter meant
.Dq unsigned integer
when used with the
.Fl i
option, which meant upper case letters would never be used for bases greater
-than 10. See the
+than 10.
+See the
.Fl U
option.)
.Pp
For functions,
.Fl u
-is the undefined attribute. See
+is the undefined attribute.
+See
.Sx Functions
above for the implications of this.
.It Fl x
-Export attribute. Parameters (or functions) are placed in the environment of
-any executed commands. Exported functions are not yet implemented.
+Export attribute.
+Parameters (or functions) are placed in the environment of
+any executed commands.
+Exported functions are not yet implemented.
.El
.It Xo Ic ulimit Op Fl acdfHlmnpsStvw
.Op Ar value
.Xc
-Display or set process limits. If no options are used, the file size limit
+Display or set process limits.
+If no options are used, the file size limit
.Pq Fl f
is assumed.
.Ar value ,
if specified, may be either an arithmetic expression or the word
.Dq unlimited .
The limits affect the shell and any processes created by the shell after a
-limit is imposed. Note that some systems may not allow limits to be increased
-once they are set. Also note that the types of limits available are system
+limit is imposed.
+Note that some systems may not allow limits to be increased
+once they are set.
+Also note that the types of limits available are system
dependent -- some systems have only the
.Fl f
limit.
.It Xo Ic unalias Op Fl adt
.Op Ar name1 ...
.Xc
-The aliases for the given names are removed. If the
+The aliases for the given names are removed.
+If the
.Fl a
-option is used, all aliases are removed. If the
+option is used, all aliases are removed.
+If the
.Fl t
or
.Fl d
The exit status is non-zero if any of the parameters were already unset, zero
otherwise.
.It Ic wait Op Ar job ...
-Wait for the specified job(s) to finish. The exit status of
+Wait for the specified job(s) to finish.
+The exit status of
.Ic wait
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
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. See
+is 127.
+See
.Sx Job control
below for the format of
.Ar job .
If no jobs are specified,
.Ic wait
waits for all currently running jobs (if any) to finish and exits with a zero
-status. If job monitoring is enabled, the completion status of jobs is printed
+status.
+If job monitoring is enabled, the completion status of jobs is printed
(this is not the case when jobs are explicitly specified).
.It Xo Ic whence Op Fl pv
.Op Ar name ...
For each
.Ar name ,
the type of command is listed (reserved word, built-in, alias,
-function, tracked alias, or executable). If the
+function, tracked alias, or executable).
+If the
.Fl p
option is used, a path search is performed even if
.Ar name
-is a reserved word, alias, etc. Without the
+is a reserved word, alias, etc.
+Without the
.Fl v
option,
.Ic whence
.Ic command Fl v
except that
.Ic whence
-will find reserved words and won't print aliases as alias commands. With the
+will find reserved words and won't print aliases as alias commands.
+With the
.Fl v
option,
.Ic whence
.El
.Ss Job control
Job control refers to the shell's ability to monitor and control jobs, which
-are processes or groups of processes created for commands or pipelines. At a
-minimum, the shell keeps track of the status of the background (i.e.,
+are processes or groups of processes created for commands or pipelines.
+At a minimum, the shell keeps track of the status of the background (i.e.,
asynchronous) jobs that currently exist; this information can be displayed
using the
.Ic jobs
-commands. If job control is fully enabled (using
+commands.
+If job control is fully enabled (using
.Ic set Fl m
or
.Ic set Fl o Ic monitor ) ,
as it is for interactive shells, the processes of a job are placed in their
-own process group. Foreground jobs can be stopped by typing the suspend
+own process group.
+Foreground jobs can be stopped by typing the suspend
character from the terminal (normally ^Z), jobs can be restarted in either the
foreground or background using the
.Ic fg
.Ic read
cannot be.
.Pp
-When a job is created, it is assigned a job number. For interactive shells,
-this number is printed inside
+When a job is created, it is assigned a job number.
+For interactive shells, this number is printed inside
.Dq \&[..\&] ,
followed by the process IDs of the processes in the job when an asynchronous
-command is run. A job may be referred to in
+command is run.
+A job may be referred to in
.Ic bg ,
.Ic fg ,
.Ic jobs ,
.It Ar signal-description Op Dq core dumped
The job was killed by a signal (e.g., memory fault, hangup, etc.; use
.Ic kill -l
-for a list of signal descriptions). The
+for a list of signal descriptions).
+The
.Dq core dumped
message indicates the process created a core file.
.El
.It Ar command
-is the command that created the process. If there are multiple processes in
+is the command that created the process.
+If there are multiple processes in
the job, each process will have a line showing its
.Ar command
and possibly its
If another attempt is immediately made to exit the shell, the stopped jobs are
sent a
.Dv HUP
-signal and the shell exits. Similarly, if the
+signal and the shell exits.
+Similarly, if the
.Ic nohup
option is not set and there are running jobs when an attempt is made to exit
-a login shell, the shell warns the user and does not exit. If another attempt
+a login shell, the shell warns the user and does not exit.
+If another attempt
is immediately made to exit the shell, the running jobs are sent a
.Dv HUP
signal and the shell exits.
with only those
.Nm ksh
features whose syntax or semantics are incompatible with a traditional Bourne
-shell disabled. Since this leaves some
+shell disabled.
+Since this leaves some
.Nm ksh
extensions exposed, caution should be used where backwards compatibility with
traditional Bourne or
.Sh BUGS
Any bugs in
.Nm pdksh
-should be reported to pdksh@cs.mun.ca. Please include the version of
+should be reported to pdksh@cs.mun.ca.
+Please include the version of
.Nm pdksh
.Po
.Ic echo $KSH_VERSION
.Pa config.h
(the file generated by the
.Pa configure
-script). New version of
+script).
+New versions of
.Nm pdksh
can be obtained from ftp://ftp.cs.mun.ca/pub/pdksh.
.Pp
.Sh AUTHORS
This shell is based on the public domain 7th edition Bourne shell clone by
Charles Forsyth and parts of the BRL shell by Doug A. Gwyn, Doug Kingston,
-Ron Natalie, Arnold Robbins, Lou Salkind, and others. The first release of
+Ron Natalie, Arnold Robbins, Lou Salkind, and others.
+The first release of
.Nm pdksh
was created by Eric Gisin, and it was subsequently maintained by John R.
MacMillan (change!john@sq.sq.com) and Simon J. Gerraty (sjg@zen.void.oz.au).
-The current maintainer is Michael Rendell (michael@cs.mun.ca). The
+The current maintainer is Michael Rendell (michael@cs.mun.ca).
+The
.Pa CONTRIBUTORS
file in the source distribution contains a more complete list of people and
their part in the shell's development.
-.\" $OpenBSD: ls.1,v 1.21 2000/01/05 18:48:31 aaron Exp $
+.\" $OpenBSD: ls.1,v 1.22 2000/03/17 18:15:14 aaron Exp $
.\" $NetBSD: ls.1,v 1.14 1995/12/05 02:44:01 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
Sort by size, largest file first.
.It Fl T
Display complete time information for the file, including
-month, day, hour, minute, second, and year. This option has no effect unless
-one of the long format
+month, day, hour, minute, second, and year.
+This option has no effect unless one of the long format
.Pq Fl l , Fl n
options is also specified.
.It Fl W
.It Fl k
Modifies the
.Fl s
-option, causing the sizes to be reported in kilobytes. Overrides any
-value specified by the
+option, causing the sizes to be reported in kilobytes.
+Overrides any value specified by the
.Ev BLOCKSIZE
environment variable.
.It Fl l
lexicographical order or the smallest or oldest entries first.
.It Fl s
Display the number of file system blocks actually used by each file,
-where partial units are rounded up to the next integer value. Blocks
-are 512 bytes unless overridden by the
+where partial units are rounded up to the next integer value.
+Blocks are 512 bytes unless overridden by the
.Fl k
flag or
.Ev BLOCKSIZE
and
.Fl u
options override each other; the last one specified determines
-the file time used. The
+the file time used.
+The
.Fl f
option overrides any occurrence of either.
.Pp
and the pathname.
In addition, for each directory whose contents are displayed, the first
line displayed is the total number of blocks used by the files in the
-directory. Blocks are 512 bytes unless overridden by the
+directory.
+Blocks are 512 bytes unless overridden by the
.Fl k
option or
.Ev BLOCKSIZE
or
.Fl n
options consists of the entry type, owner permissions, and group
-permissions. The entry type character describes the type of file, as
-follows:
+permissions.
+The entry type character describes the type of file, as follows:
.Pp
.Bl -tag -width 4n -offset indent -compact
.It Sy b
-.\" $OpenBSD: md5.1,v 1.7 1998/12/15 01:20:23 aaron Exp $
+.\" $OpenBSD: md5.1,v 1.8 2000/03/17 18:15:14 aaron Exp $
.\"
.Dd February 14, 1994
.Dt MD5 1
.Em RSA .
.Sh OPTIONS
The following four options may be used in any combination and must
-precede any files named on the command line. The MD5
+precede any files named on the command line.
+The MD5
sum of each file listed on the command line is printed after the options
are processed.
.Bl -tag -width Fl
-.\" $OpenBSD: mkdir.1,v 1.10 1999/09/23 19:52:48 aaron Exp $
+.\" $OpenBSD: mkdir.1,v 1.11 2000/03/17 18:15:14 aaron Exp $
.\" $NetBSD: mkdir.1,v 1.9 1995/07/25 19:37:13 jtc Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
using mode
.Li rwxrwxrwx (\&0777)
as modified by the current
-.Xr umask 2 .
+.Xr umask 2 .
.Pp
The options are as follows:
.Bl -tag -width indent
Intermediate directories are created with permission bits of
.Li rwxrwxrwx (\&0777)
as modified by the current umask, plus write and search
-permission for the owner. Do not consider it an error if the
+permission for the owner.
+Do not consider it an error if the
argument directory already exists.
.El
.Pp
-.\" $OpenBSD: mt.1,v 1.14 1999/08/17 14:04:00 aaron Exp $
+.\" $OpenBSD: mt.1,v 1.15 2000/03/17 18:15:14 aaron Exp $
.\" $NetBSD: mt.1,v 1.8 1996/05/21 10:23:55 mrg Exp $
.\"
.\" Copyright (c) 1981, 1990, 1993
utility sends commands to a magnetic tape drive.
By default,
.Nm
-performs the requested operation once. Operations
-may be performed multiple times by specifying
+performs the requested operation once.
+Operations may be performed multiple times by specifying
.Ar count .
Note
that
writes to the named tape device on the remote host using
.Xr rmt 8 .
.Pp
-The available commands are listed below. Only as many
-characters as are required to uniquely identify a command
+The available commands are listed below.
+Only as many characters as are required to uniquely identify a command
need be specified.
.Bl -tag -width "eof, weof"
.It Cm eof , weof
-.\" $OpenBSD: mv.1,v 1.8 1999/08/17 14:04:01 aaron Exp $
+.\" $OpenBSD: mv.1,v 1.9 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: mv.1,v 1.8 1995/03/21 09:06:51 cgd Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
option.
.Pp
As the
-.Xr rename 2
+.Xr rename 2
call does not work across file systems,
.Nm
uses
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: cpio.1,v 1.9 2000/03/05 00:28:52 aaron Exp $
+.\" $OpenBSD: cpio.1,v 1.10 2000/03/17 18:15:15 aaron Exp $
.\"
.Dd February 16, 1997
.Dt CPIO 1
The options are as follows:
.Bl -tag -width Fl
.It Fl o
-Create an archive. Reads the list of files to store in the
+Create an archive.
+Reads the list of files to store in the
archive from standard input, and writes the archive on standard
output.
.Bl -tag -width Fl
.It Fl O Ar archive
Use the specified file name as the archive to write to.
.It Fl H Ar format
-Write the archive in the specified format. Recognized
-formats are:
+Write the archive in the specified format.
+Recognized formats are:
.Bl -tag -width Ds
.It Ar bcpio
Old binary cpio format.
.It Fl L
Follow symbolic links.
.It Fl v
-Be verbose about operations. List filenames as they are
-written to the archive.
+Be verbose about operations.
+List filenames as they are written to the archive.
.It Fl z
Compress archive using
.Xr gzip 1
format.
.El
.It Fl i
-Restore files from an archive. Reads the archive file from
+Restore files from an archive.
+Reads the archive file from
standard input and extracts files matching the
.Ar patterns
that were specified on the command line.
.It Fl I Ar archive
Use the specified file as the input for the archive.
.It Fl H Ar format
-Read an archive of the specified format. Recognized
-formats are:
+Read an archive of the specified format.
+Recognized formats are:
.Bl -tag -width Ds
.It Ar bcpio
Old binary cpio format.
Overwrite files even when the file in the archive is
older than the one that will be overwritten.
.It Fl v
-Be verbose about operations. List filenames as they are
-copied in from the archive.
+Be verbose about operations.
+List filenames as they are copied in from the archive.
.It Fl z
Uncompress archive using
.Xr gzip 1
Overwrite files even when the original file being copied is
older than the one that will be overwritten.
.It Fl v
-Be verbose about operations. List filenames as they are
-copied.
+Be verbose about operations.
+List filenames as they are copied.
.El
.El
.Sh ERRORS
.Fl p
option is specified, a diagnostic message is written to standard
error and a non-zero exit value will be returned, but processing
-will continue. In the case where
+will continue.
+In the case where
.Nm
cannot create a link to a file,
.Nm
-.\" $OpenBSD: pax.1,v 1.17 2000/03/14 21:31:41 aaron Exp $
+.\" $OpenBSD: pax.1,v 1.18 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: pax.1,v 1.3 1995/03/21 09:07:37 cgd Exp $
.\"
.\" Copyright (c) 1992 Keith Muller.
.Cm g
continues to apply the substitution expression to the pathname substring
which starts with the first character following the end of the last successful
-substitution. The first unsuccessful substitution stops the operation of the
+substitution.
+The first unsuccessful substitution stops the operation of the
.Cm g
option.
The optional trailing
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: tar.1,v 1.23 1999/08/16 18:40:03 aaron Exp $
+.\" $OpenBSD: tar.1,v 1.24 2000/03/17 18:15:15 aaron Exp $
.\"
.Dd June 11, 1996
.Dt TAR 1
The
.Nm
command creates, adds files to, or extracts files from an
-archive file in \*Qtar\*U format. A tar archive is often
+archive file in \*Qtar\*U format.
+A tar archive is often
stored on a magnetic tape, but can be a floppy or a regular
disk file.
.Pp
Create new archive, or overwrite an existing archive,
adding the specified files to it.
.It Fl r
-Append the named new files to existing archive. Note that
-this will only work on media on which an end-of-file mark
+Append the named new files to existing archive.
+Note that this will only work on media on which an end-of-file mark
can be overwritten.
.It Fl t
-List contents of archive. If any files are named on the
+List contents of archive.
+If any files are named on the
command line, only those files will be listed.
.It Fl u
Alias for
.Fl r .
.It Fl x
-Extract files from archive. If any files are named on the
+Extract files from archive.
+If any files are named on the
command line, only those files will be extracted from the
-archive. If more than one copy of a file exists in the
+archive.
+If more than one copy of a file exists in the
archive, later copies will overwrite earlier copies during
-extraction. The file mode and modification time are preserved
-if possible. The file mode is subject to modification by the
+extraction.
+The file mode and modification time are preserved
+if possible.
+The file mode is subject to modification by the
.Xr umask 2 .
.El
.Pp
.It Fl b Ar "blocking factor"
Set blocking factor to use for the archive.
.Nm
-uses 512 byte blocks. The default is 20, the maximum is 126.
+uses 512 byte blocks.
+The default is 20, the maximum is 126.
Archives with a blocking factor larger 63 violate the
.Tn POSIX
standard and will not be portable to all systems.
.It Fl e
Stop after first error.
.It Fl f Ar archive
-Filename where the archive is stored. Defaults to
+Filename where the archive is stored.
+Defaults to
.Pa /dev/rst0 .
.It Fl h
Follow symbolic links as if they were normal files
the current
.Xr umask 2 .
The setuid and setgid bits are only preserved if the user is
-the superuser. Only meaningful in conjunction with the
+the superuser.
+Only meaningful in conjunction with the
.Fl x
flag.
.It Fl q
.Cm g
continues to apply the substitution expression to the pathname substring
which starts with the first character following the end of the last successful
-substitution. The first unsuccessful substitution stops the operation of the
+substitution.
+The first unsuccessful substitution stops the operation of the
.Cm g
option.
The optional trailing
.It Fl v
Verbose operation mode.
.It Fl w
-Interactively rename files. This option causes
+Interactively rename files.
+This option causes
.Nm
to prompt the user for the filename to use when storing or
extracting files in an archive.
Compress archive using gzip.
.It Fl C Ar directory
This is a positional argument which sets the working directory for the
-following files. When extracting, files will be extracted into
+following files.
+When extracting, files will be extracted into
the specified directory; when creating, the specified files will be matched
from the directory.
.It Fl H
.Fl p
option is specified, a diagnostic message is written to standard
error and a non-zero exit value will be returned, but processing
-will continue. In the case where
+will continue.
+In the case where
.Nm
cannot create a link to a file,
.Nm
-.\" $OpenBSD: ps.1,v 1.23 1999/11/25 19:23:12 deraadt Exp $
+.\" $OpenBSD: ps.1,v 1.24 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: ps.1,v 1.16 1996/03/21 01:36:28 jtc Exp $
.\"
.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
.It wchan
The event (an address in the system) on which a process waits.
When printed numerically, the initial part of the address is
-trimmed off and the result is printed in hex: for example, 0x80324000 prints
+trimmed off and the result is printed in hex; for example, 0x80324000 prints
as 324000.
.El
.Pp
-.\" $OpenBSD: rcp.1,v 1.10 1999/08/17 14:04:01 aaron Exp $
+.\" $OpenBSD: rcp.1,v 1.11 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: rcp.1,v 1.6 1995/07/25 19:37:25 jtc Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
.Sh DESCRIPTION
The
.Nm
-utility copies files between machines. Each
+utility copies files between machines.
+Each
.Ar file
or
.Ar directory
.Ar file2
are preserved if it already existed; otherwise the mode of the source file
modified by the
-.Xr umask 2
+.Xr umask 2
on the destination host is used.
.It Fl r
If any of the source files are directories,
.Nm
does not prompt for passwords; it performs remote execution
via
-.Xr rsh 1 ,
+.Xr rsh 1 ,
and requires the same authorization.
.Pp
.Nm
-.\" $OpenBSD: stty.1,v 1.20 2000/03/06 21:46:56 aaron Exp $
+.\" $OpenBSD: stty.1,v 1.21 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: stty.1,v 1.10 1995/09/07 06:57:14 jtc Exp $
.\"
.\" Copyright (c) 1990, 1993, 1994
.It Fl f Ar file
Open and use the terminal named by
.Ar file
-rather than using standard input. The file is opened
-using the
+rather than using standard input.
+The file is opened using the
.Dv O_NONBLOCK
flag of
.Xr open 2 ,
characteristics:
.Ss Control modes
Control mode flags affect hardware characteristics associated with the
-terminal. This corresponds to the
+terminal.
+This corresponds to the
.Li c_cflag
in the termios structure.
.Bl -tag -width Fl
.It Cm imaxbel Pq Fl imaxbel
The system imposes a limit of
.Dv MAX_INPUT
-(currently 255) characters in the input queue. If
+(currently 255) characters in the input queue.
+If
.Cm imaxbel
is set and the input queue limit has been reached,
subsequent input causes the system to send an ASCII BEL
-character to the output queue (the terminal beeps at you). Otherwise,
-if
+character to the output queue (the terminal beeps at you).
+Otherwise, if
.Cm imaxbel
is unset and the input queue is full, the next input character causes
the entire input and output queues to be discarded.
.It Cm tostop Pq Fl tostop
Send (do not send)
.Dv SIGTTOU
-for background output. This causes background jobs to stop if they attempt
+for background output.
+This causes background jobs to stop if they attempt
terminal output.
.It Cm altwerase Pq Fl altwerase
Use (do not use) an alternate word erase algorithm when processing
.Dv ERASE
character).
.It Cm mdmbuf Pq Fl mdmbuf
-If set, flow control output based on condition of Carrier Detect. Otherwise
+If set, flow control output based on condition of Carrier Detect.
+Otherwise
writes return an error if Carrier Detect is low (and Carrier is not being
ignored with the
.Dv CLOCAL
.Cm cs7 ,
and
.Cm parodd .
-.It Fl parity , evenp , oddp
+.It Fl parity , evenp , oddp
Disable
.Cm parenb
and set
.It Cm raw Pq Fl raw
If set, change the modes of the terminal so that no input or output processing
is performed. If unset, change the modes of the terminal to some reasonable
-state that performs input and output processing. Note that since the
-terminal driver no longer has a single
+state that performs input and output processing.
+Note that since the terminal driver no longer has a single
.Dv RAW
bit, it is not possible to intuit what flags were set prior to setting
.Cm raw .
.Nm
utility is expected to be
.St -p1003.2
-compatible. The flags
+compatible.
+The flags
.Fl e
and
.Fl f
-.\" $OpenBSD: test.1,v 1.10 1999/06/04 02:45:14 aaron Exp $
+.\" $OpenBSD: test.1,v 1.11 2000/03/17 18:15:15 aaron Exp $
.\" $NetBSD: test.1,v 1.6 1995/03/21 07:04:03 cgd Exp $
.\"
.\" Copyright (c) 1991, 1993
.Ar file
exists and is a symbolic link.
This operator is for COMPATABILITY purposes,
-do not rely on its existence. Use
+do not rely on its existence.
+Use
.Fl L
instead.
.It Fl k Ar file
.Sh GRAMMAR AMBIGUITY
The
.Nm
-grammar is inherently ambiguous. In order to assure a degree of consistency,
+grammar is inherently ambiguous.
+In order to assure a degree of consistency,
the cases described in
.St -p1003.2
section D11.2/4.62.4
are evaluated consistently according to the rules specified in the
-standards document. All other cases are subject to the ambiguity in the
+standards document.
+All other cases are subject to the ambiguity in the
command semantics.
.Sh RETURN VALUES
The