according to groff_char(7) and my own hard experiences, there is more wrong

with GNU groff – add some special handling to the BSD mdoc macros for it so
that the manual pages look good in both utf8 and ps (PDF) mode; also fix in
mksh wrong display of ` (groff: ‘), ' (groff: ’), \' (groff: ´), \- (groff:
U+2212 −), the en dash (nroff doesn’t have it, use the em dash there ONLY),
and ~ and ^ (groff: placed atop and size-reduced, for use as diacritics, in
manual pages bad since these are control characters there)
→ PDF manpage now has ‘’ “” and good-looking hyphens and mini and ~ and ^
→ utf8 manpage now has ‘’ “”, good-looking hyphens, cut’n’pasteable mini
→ nroff manpage still has '' "" instead of ugly `' ``'' or even `´
→ Debian lintian won’t complain any longer
This commit is contained in:
tg 2008-03-04 00:09:34 +00:00
parent 8a3169a0dd
commit 231b682cdf

318
mksh.1
View File

@ -1,6 +1,26 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.112 2008/03/03 22:38:41 tg Exp $ .\" $MirOS: src/bin/mksh/mksh.1,v 1.113 2008/03/04 00:09:34 tg Exp $
.\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $ .\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $
.\" .\"-
.\" Try to make GNU groff and AT&T nroff more compatible
.\" * ` generates in groff, so use \`
.\" * ' generates in groff, \' generates ´, so use \*(aq
.\" * - generates in groff, \- generates , fixed in tmac/mdoc/doc-groff
.\" thus use - for hyphens and \- for minus signs and option dashes
.\" * ~ is size-reduced and placed atop in groff, so use \*(TI
.\" * ^ is size-reduced and placed atop in groff, so use \*(ha
.\" * \(en does not work in nroff, so use \*(en
.ie \n(.g \{\
. ds aq \(aq
. ds TI \(ti
. ds ha \(ha
. ds en \(en
.\}
.el \{\
. ds aq '
. ds TI ~
. ds ha ^
. ds en \(em
.\}
.\" Implement .Dd with the Mdocdate RCS keyword .\" Implement .Dd with the Mdocdate RCS keyword
.rn Dd xD .rn Dd xD
.de Dd .de Dd
@ -10,7 +30,7 @@
.el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .el .xD \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8
.. ..
.\"- .\"-
.Dd $Mdocdate: March 3 2008 $ .Dd $Mdocdate: March 4 2008 $
.Dt MKSH 1 .Dt MKSH 1
.Os MirBSD .Os MirBSD
.Sh NAME .Sh NAME
@ -182,7 +202,7 @@ If the
parameter is set when an interactive shell starts (or, in the case of login parameter is set when an interactive shell starts (or, in the case of login
shells, after any profiles are processed), its value is subjected to shells, after any profiles are processed), its value is subjected to
parameter, command, arithmetic, and tilde parameter, command, arithmetic, and tilde
.Pq Sq ~ .Pq Sq \*(TI
substitution and the resulting file substitution and the resulting file
(if any) is read and executed. (if any) is read and executed.
If the If the
@ -261,17 +281,17 @@ Whitespace and meta-characters can be quoted individually using a backslash
or in groups using double or in groups using double
.Pq Sq \&" .Pq Sq \&"
or single or single
.Pq Sq ' .Pq Sq \*(aq
quotes. quotes.
Note that the following characters are also treated specially by the Note that the following characters are also treated specially by the
shell and must be quoted if they are to represent themselves: shell and must be quoted if they are to represent themselves:
.Ql \e , .Ql \e ,
.Ql \&" , .Ql \&" ,
.Ql ' , .Ql \*(aq ,
.Ql # , .Ql # ,
.Ql $ , .Ql $ ,
.Ql ` , .Ql \` ,
.Ql ~ , .Ql \*(TI ,
.Ql { , .Ql { ,
.Ql } , .Ql } ,
.Ql * , .Ql * ,
@ -282,7 +302,7 @@ The first three of these are the above mentioned quoting characters (see
.Sx Quoting .Sx Quoting
below); below);
.Ql # , .Ql # ,
if used at the beginning of a word, introduces a comment \(em everything after if used at the beginning of a word, introduces a comment \*(en everything after
the the
.Ql # .Ql #
up to the nearest newline is ignored; up to the nearest newline is ignored;
@ -290,11 +310,11 @@ up to the nearest newline is ignored;
is used to introduce parameter, command, and arithmetic substitutions (see is used to introduce parameter, command, and arithmetic substitutions (see
.Sx Substitution .Sx Substitution
below); below);
.Ql ` .Ql \`
introduces an old-style command substitution (see introduces an old-style command substitution (see
.Sx Substitution .Sx Substitution
below); below);
.Ql ~ .Ql \*(TI
begins a directory expansion (see begins a directory expansion (see
.Sx Tilde expansion .Sx Tilde expansion
below); below);
@ -386,7 +406,7 @@ only if the exit status of
.Ar cmd1 .Ar cmd1
is zero; is zero;
.Ql \*(Ba\*(Ba .Ql \*(Ba\*(Ba
is the opposite \(em is the opposite \*(en
.Ar cmd2 .Ar cmd2
is executed only if the exit status of is executed only if the exit status of
.Ar cmd1 .Ar cmd1
@ -785,19 +805,19 @@ case both the
.Ql \e .Ql \e
and the newline are stripped. and the newline are stripped.
Second, a single quote Second, a single quote
.Pq Sq ' .Pq Sq \*(aq
quotes everything up to the next single quote (this may span lines). quotes everything up to the next single quote (this may span lines).
Third, a double quote Third, a double quote
.Pq Sq \&" .Pq Sq \&"
quotes all characters, except quotes all characters, except
.Ql $ , .Ql $ ,
.Ql ` .Ql \`
and and
.Ql \e , .Ql \e ,
up to the next unquoted double quote. up to the next unquoted double quote.
.Ql $ .Ql $
and and
.Ql ` .Ql \`
inside double quotes have their usual meaning (i.e. parameter, command, or inside double quotes have their usual meaning (i.e. parameter, command, or
arithmetic substitution) except no field splitting is carried out on the arithmetic substitution) except no field splitting is carried out on the
results of double-quoted substitutions. results of double-quoted substitutions.
@ -806,7 +826,7 @@ If a
inside a double-quoted string is followed by inside a double-quoted string is followed by
.Ql \e , .Ql \e ,
.Ql $ , .Ql $ ,
.Ql ` , .Ql \` ,
or or
.Ql \&" , .Ql \&" ,
it is replaced by the second character; if it is followed by a newline, both it is replaced by the second character; if it is followed by a newline, both
@ -830,18 +850,18 @@ expanded is found.
.Pp .Pp
The following command aliases are defined automatically by the shell: The following command aliases are defined automatically by the shell:
.Bd -literal -offset indent .Bd -literal -offset indent
autoload='typeset \-fu' autoload=\*(aqtypeset \-fu\*(aq
functions='typeset \-f' functions=\*(aqtypeset \-f\*(aq
hash='alias \-t' hash=\*(aqalias \-t\*(aq
history='fc \-l' history=\*(aqfc \-l\*(aq
integer='typeset \-i' integer=\*(aqtypeset \-i\*(aq
local='typeset' local=\*(aqtypeset\*(aq
login='exec login' login=\*(aqexec login\*(aq
nohup='nohup ' nohup=\*(aqnohup \*(aq
r='fc \-e \-' r=\*(aqfc \-e \-\*(aq
stop='kill \-STOP' stop=\*(aqkill \-STOP\*(aq
suspend='kill \-STOP $$' suspend=\*(aqkill \-STOP $$\*(aq
type='whence \-v' type=\*(aqwhence \-v\*(aq
.Ed .Ed
.Pp .Pp
Tracked aliases allow the shell to remember where it found a particular Tracked aliases allow the shell to remember where it found a particular
@ -899,7 +919,7 @@ or
command substitutions take the form command substitutions take the form
.Pf $( Ns Ar command Ns \&) .Pf $( Ns Ar command Ns \&)
or (deprecated) or (deprecated)
.Pf ` Ns Ar command Ns ` ; .Pf \` Ns Ar command Ns \` ;
and arithmetic substitutions take the form and arithmetic substitutions take the form
.Pf $(( Ns Ar expression Ns )) . .Pf $(( Ns Ar expression Ns )) .
.Pp .Pp
@ -983,12 +1003,12 @@ For
substitutions, normal quoting rules are used when substitutions, normal quoting rules are used when
.Ar command .Ar command
is parsed; however, for the deprecated is parsed; however, for the deprecated
.Pf ` Ns Ar command Ns ` .Pf \` Ns Ar command Ns \`
form, a form, a
.Ql \e .Ql \e
followed by any of followed by any of
.Ql $ , .Ql $ ,
.Ql ` , .Ql \` ,
or or
.Ql \e .Ql \e
is stripped (a is stripped (a
@ -1475,7 +1495,7 @@ The default is 500.
The default directory for the The default directory for the
.Ic cd .Ic cd
command and the value substituted for an unqualified command and the value substituted for an unqualified
.Ic ~ .Ic \*(TI
(see (see
.Sx Tilde expansion .Sx Tilde expansion
below). below).
@ -1571,7 +1591,7 @@ root-vs-user distinguishing clause are (in this example) executed at
assignment time, while the $USER and $PWD are escaped assignment time, while the $USER and $PWD are escaped
and thus will be evaluated each time a prompt is displayed): and thus will be evaluated each time a prompt is displayed):
.Bd -literal .Bd -literal
PS1='${USER:=$(id \-un)}'"@${HOSTNAME:=$(hostname \-s)}:\e$PWD $( PS1=\*(aq${USER:=$(id \-un)}\*(aq"@${HOSTNAME:=$(hostname \-s)}:\e$PWD $(
if (( $(id \-u) )); then print \e$; else print \e#; fi) " if (( $(id \-u) )); then print \e$; else print \e#; fi) "
.Ed .Ed
.Pp .Pp
@ -1597,7 +1617,7 @@ or use double quotes.
The latter is more practical. The latter is more practical.
This is a more complex example, This is a more complex example,
avoiding to directly enter special characters (for example with avoiding to directly enter special characters (for example with
.Ic ^V .Ic \*(haV
in the emacs editing mode), in the emacs editing mode),
which embeds the current working directory, which embeds the current working directory,
in reverse video, in reverse video,
@ -1664,7 +1684,7 @@ files are created in
.Ss Tilde expansion .Ss Tilde expansion
Tilde expansion which is done in parallel with parameter substitution, is done Tilde expansion which is done in parallel with parameter substitution, is done
on words starting with an unquoted on words starting with an unquoted
.Ql ~ . .Ql \*(TI .
The characters following the tilde, up to the first The characters following the tilde, up to the first
.Ql / , .Ql / ,
if any, are assumed to be a login name. if any, are assumed to be a login name.
@ -1703,7 +1723,7 @@ The home directory of previously expanded login names are cached and re-used.
The The
.Ic alias \-d .Ic alias \-d
command may be used to list, change, and add to this cache (e.g.\& command may be used to list, change, and add to this cache (e.g.\&
.Ic alias \-d fac=/usr/local/facilities; cd ~fac/bin ) . .Ic alias \-d fac=/usr/local/facilities; cd \*(TIfac/bin ) .
.Ss Brace expansion (alteration) .Ss Brace expansion (alteration)
Brace expressions take the following form: Brace expressions take the following form:
.Bd -unfilled -offset indent .Bd -unfilled -offset indent
@ -1953,7 +1973,7 @@ backslash
.Pq Sq \e .Pq Sq \e
escapes for escapes for
.Ql $ , .Ql $ ,
.Ql ` , .Ql \` ,
.Ql \e , .Ql \e ,
and and
.Ql \enewline , .Ql \enewline ,
@ -2035,17 +2055,17 @@ and integer constants and may be combined with the following C operators
.Pp .Pp
Unary operators: Unary operators:
.Bd -literal -offset indent .Bd -literal -offset indent
+ \- ! ~ ++ \-\- + \- ! \*(TI ++ \-\-
.Ed .Ed
.Pp .Pp
Binary operators: Binary operators:
.Bd -literal -offset indent .Bd -literal -offset indent
, ,
= *= /= %= += \-= \*(Lt\*(Lt= \*(Gt\*(Gt= &= ^= \*(Ba= = *= /= %= += \-= \*(Lt\*(Lt= \*(Gt\*(Gt= &= \*(ha= \*(Ba=
\*(Ba\*(Ba \*(Ba\*(Ba
&& &&
\*(Ba \*(Ba
^ \*(ha
& &
== != == !=
\*(Lt \*(Lt= \*(Gt= \*(Gt \*(Lt \*(Lt= \*(Gt= \*(Gt
@ -2097,7 +2117,7 @@ Negation.
.It \&! .It \&!
Logical NOT; Logical NOT;
the result is 1 if argument is zero, 0 if not. the result is 1 if argument is zero, 0 if not.
.It ~ .It \*(TI
Arithmetic (bit-wise) NOT. Arithmetic (bit-wise) NOT.
.It ++ .It ++
Increment; must be applied to a parameter (not a literal or other expression). Increment; must be applied to a parameter (not a literal or other expression).
@ -2117,7 +2137,7 @@ The result is the value of the expression on the right-hand side.
Assignment; the variable on the left is set to the value on the right. Assignment; the variable on the left is set to the value on the right.
.It Xo .It Xo
.No *= /= += \-= \*(Lt\*(Lt= .No *= /= += \-= \*(Lt\*(Lt=
.No \*(Gt\*(Gt= &= ^= \*(Ba= .No \*(Gt\*(Gt= &= \*(ha= \*(Ba=
.Xc .Xc
Assignment operators. Assignment operators.
.Sm off .Sm off
@ -2151,7 +2171,7 @@ 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 right argument is evaluated only if the left argument is non-zero.
.It \*(Ba .It \*(Ba
Arithmetic (bit-wise) OR. Arithmetic (bit-wise) OR.
.It ^ .It \*(ha
Arithmetic (bit-wise) XOR Arithmetic (bit-wise) XOR
(exclusive-OR). (exclusive-OR).
.It & .It &
@ -2555,26 +2575,26 @@ two prefices and the control character is ignored, any
other trailing character will be processed afterwards. other trailing character will be processed afterwards.
.Pp .Pp
Control characters may be written using caret notation Control characters may be written using caret notation
i.e. ^X represents Control-X. i.e. \*(haX represents Control-X.
Note that although only two prefix characters (usually ESC and ^X) Note that although only two prefix characters (usually ESC and \*(haX)
are supported, some multi-character sequences can be supported. are supported, some multi-character sequences can be supported.
.Pp .Pp
The following default bindings show how the arrow keys, the home, end and The following default bindings show how the arrow keys, the home, end and
delete key on a BSD wsvt25, xterm-xfree86 or GNU screen terminal are bound delete key on a BSD wsvt25, xterm-xfree86 or GNU screen terminal are bound
(of course some escape sequences won't work out quite this nicely): (of course some escape sequences won't work out quite this nicely):
.Bd -literal -offset indent .Bd -literal -offset indent
bind '^[['=prefix\-2 bind \*(aq\*(ha[[\*(aq=prefix\-2
bind '^XA'=up\-history bind \*(aq\*(haXA\*(aq=up\-history
bind '^XB'=down\-history bind \*(aq\*(haXB\*(aq=down\-history
bind '^XC'=forward\-char bind \*(aq\*(haXC\*(aq=forward\-char
bind '^XD'=backward\-char bind \*(aq\*(haXD\*(aq=backward\-char
bind '^X1~'=beginning\-of\-line bind \*(aq\*(haX1\*(TI\*(aq=beginning\-of\-line
bind '^X7~'=beginning\-of\-line bind \*(aq\*(haX7\*(TI\*(aq=beginning\-of\-line
bind '^XH'=beginning\-of\-line bind \*(aq\*(haXH\*(aq=beginning\-of\-line
bind '^X4~'=end\-of\-line bind \*(aq\*(haX4\*(TI\*(aq=end\-of\-line
bind '^X8~'=end\-of\-line bind \*(aq\*(haX8\*(TI\*(aq=end\-of\-line
bind '^XF'=end\-of\-line bind \*(aq\*(haXF\*(aq=end\-of\-line
bind '^X3~'=delete\-char\-forward bind \*(aq\*(haX3\*(TI\*(aq=delete\-char\-forward
.Ed .Ed
.Pp .Pp
.It Ic break Op Ar level .It Ic break Op Ar level
@ -2856,7 +2876,7 @@ and
.Fl s .Fl s
is identical: re-execute the selected command without invoking an editor. is identical: re-execute the selected command without invoking an editor.
This command is usually accessed with the predefined This command is usually accessed with the predefined
.Ic alias r='fc \-e \-' . .Ic alias r=\*(aqfc \-e \-\*(aq .
.Pp .Pp
.It Ic fg Op Ar job ... .It Ic fg Op Ar job ...
Resume the specified job(s) in the foreground. Resume the specified job(s) in the foreground.
@ -3173,7 +3193,7 @@ which case the string is used as a prompt (printed to standard error before
any input is read) if the input is a any input is read) if the input is a
.Xr tty 4 .Xr tty 4
(e.g.\& (e.g.\&
.Ic read nfoo?'number of foos: ' ) . .Ic read nfoo?\*(aqnumber of foos: \*(aq ) .
.Pp .Pp
The The
.Fl u Ns Ar n .Fl u Ns Ar n
@ -3429,7 +3449,7 @@ Enable BRL emacs-like command-line editing (interactive shells only); see
.Sx Emacs editing mode . .Sx Emacs editing mode .
.It Ic gmacs .It Ic gmacs
Enable gmacs-like command-line editing (interactive shells only). Enable gmacs-like command-line editing (interactive shells only).
Currently identical to emacs editing except that transpose\-chars (^T) acts Currently identical to emacs editing except that transpose\-chars (\*(haT) acts
slightly differently. slightly differently.
.It Ic ignoreeof .It Ic ignoreeof
The shell will not (easily) exit when end-of-file is read; The shell will not (easily) exit when end-of-file is read;
@ -3503,9 +3523,9 @@ Enable
command-line editing (interactive shells only). command-line editing (interactive shells only).
.It Ic vi\-esccomplete .It Ic vi\-esccomplete
In vi command-line editing, do command and file name completion when escape In vi command-line editing, do command and file name completion when escape
(^[) is entered in command mode. (\*(ha[) is entered in command mode.
.It Ic vi\-tabcomplete .It Ic vi\-tabcomplete
In vi command-line editing, do command and file name completion when tab (^I) In vi command-line editing, do command and file name completion when tab (\*(haI)
is entered in insert mode. is entered in insert mode.
This is the default. This is the default.
.It Ic viraw .It Ic viraw
@ -3514,7 +3534,7 @@ In the original Korn shell, unless
.Ic viraw .Ic viraw
was set, the vi command-line mode would let the was set, the vi command-line mode would let the
.Xr tty 4 .Xr tty 4
driver do the work until ESC (^[) was entered. driver do the work until ESC (\*(ha[) was entered.
.Nm .Nm
is always in viraw mode. is always in viraw mode.
.El .El
@ -3536,7 +3556,7 @@ 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. If no options or arguments are given, the values of all names are printed.
For unknown historical reasons, a lone For unknown historical reasons, a lone
.Ql \- .Ql \-
option is treated specially \(em it clears both the option is treated specially \*(en it clears both the
.Fl x .Fl x
and and
.Fl v .Fl v
@ -3857,7 +3877,7 @@ the shell to exit if the
.Fl e .Fl e
or or
.Ic errexit .Ic errexit
option were set \(em see the option were set \*(en see the
.Ic set .Ic set
command above). command above).
.Dv EXIT .Dv EXIT
@ -4070,7 +4090,7 @@ limit is imposed.
Note that some systems may not allow limits to be increased Note that some systems may not allow limits to be increased
once they are set. once they are set.
Also note that the types of limits available are system Also note that the types of limits available are system
dependent \(em some systems have only the dependent \*(en some systems have only the
.Fl f .Fl f
limit. limit.
.Bl -tag -width 5n .Bl -tag -width 5n
@ -4274,7 +4294,7 @@ or
as it is for interactive shells, the processes of a job are placed in their as it is for interactive shells, the processes of a job are placed in their
own process group. own process group.
Foreground jobs can be stopped by typing the suspend Foreground jobs can be stopped by typing the suspend
character from the terminal (normally ^Z), jobs can be restarted in either the character from the terminal (normally \*(haZ), jobs can be restarted in either the
foreground or background using the foreground or background using the
.Ic fg .Ic fg
and and
@ -4356,7 +4376,7 @@ The job exited.
is the exit status of the job which is omitted if the status is zero. is the exit status of the job which is omitted if the status is zero.
.It Running .It Running
The job has neither stopped nor exited (note that running does not necessarily The job has neither stopped nor exited (note that running does not necessarily
mean consuming CPU time \(em mean consuming CPU time \*(en
the process could be blocked waiting for some event). the process could be blocked waiting for some event).
.It Stopped Op Ar signal .It Stopped Op Ar signal
The job was stopped by the indicated The job was stopped by the indicated
@ -4457,10 +4477,10 @@ an
.Op Ar n .Op Ar n
(if the command can be prefixed with a count); and any keys the command is (if the command can be prefixed with a count); and any keys the command is
bound to by default, written using caret notation bound to by default, written using caret notation
e.g. the ASCII ESC character is written as ^[. e.g. the ASCII ESC character is written as \*(ha[.
These control sequences are not case sensitive. These control sequences are not case sensitive.
A count prefix for a command is entered using the sequence A count prefix for a command is entered using the sequence
.Pf ^[ Ns Ar n , .Pf \*(ha[ Ns Ar n ,
where where
.Ar n .Ar n
is a sequence of 1 or more digits. is a sequence of 1 or more digits.
@ -4481,7 +4501,7 @@ characters (e.g.\&
are bound to are bound to
reasonable substitutes and override the default bindings. reasonable substitutes and override the default bindings.
.Bl -tag -width Ds .Bl -tag -width Ds
.It abort: ^C, ^G .It abort: \*(haC, \*(haG
Abort the current command, empty the line buffer and Abort the current command, empty the line buffer and
set the exit state to interrupted. set the exit state to interrupted.
.It auto\-insert: Op Ar n .It auto\-insert: Op Ar n
@ -4489,14 +4509,14 @@ Simply causes the character to appear as literal input.
Most ordinary characters are bound to this. Most ordinary characters are bound to this.
.It Xo backward\-char: .It Xo backward\-char:
.Op Ar n .Op Ar n
.No ^B , ^XD .No \*(haB , \*(haXD
.Xc .Xc
Moves the cursor backward Moves the cursor backward
.Ar n .Ar n
characters. characters.
.It Xo backward\-word: .It Xo backward\-word:
.Op Ar n .Op Ar n
.No ^[b .No \*(ha[b
.Xc .Xc
Moves the cursor backward to the beginning of the word; words consist of Moves the cursor backward to the beginning of the word; words consist of
alphanumerics, underscore alphanumerics, underscore
@ -4504,27 +4524,27 @@ alphanumerics, underscore
and dollar sign and dollar sign
.Pq Sq $ .Pq Sq $
characters. characters.
.It beginning\-of\-history: ^[\*(Lt .It beginning\-of\-history: \*(ha[\*(Lt
Moves to the beginning of the history. Moves to the beginning of the history.
.It beginning\-of\-line: ^A .It beginning\-of\-line: \*(haA
Moves the cursor to the beginning of the edited input line. Moves the cursor to the beginning of the edited input line.
.It Xo capitalise\-word: .It Xo capitalise\-word:
.Op Ar n .Op Ar n
.No ^[C , ^[c .No \*(ha[C , \*(ha[c
.Xc .Xc
Uppercase the first character in the next Uppercase the first character in the next
.Ar n .Ar n
words, leaving the cursor past the end of the last word. words, leaving the cursor past the end of the last word.
.It clear\-screen: ^[^L .It clear\-screen: \*(ha[\*(haL
Prints a compile-time configurable sequence to clear the screen and home Prints a compile-time configurable sequence to clear the screen and home
the cursor, redraws the entire prompt and the currently edited input line. the cursor, redraws the entire prompt and the currently edited input line.
The default sequence works for almost all standard terminals. The default sequence works for almost all standard terminals.
.It comment: ^[# .It comment: \*(ha[#
If the current line does not begin with a comment character, one is added at If the current line does not begin with a comment character, one is added at
the beginning of the line and the line is entered (as if return had been the beginning of the line and the line is entered (as if return had been
pressed); otherwise, the existing comment characters are removed and the cursor pressed); otherwise, the existing comment characters are removed and the cursor
is placed at the beginning of the line. is placed at the beginning of the line.
.It complete: ^[^[ .It complete: \*(ha[\*(ha[
Automatically completes as much as is unique of the command name or the file Automatically completes as much as is unique of the command name or the file
name containing the cursor. name containing the cursor.
If the entire remaining command or file name is If the entire remaining command or file name is
@ -4535,27 +4555,27 @@ is appended.
If there is no command or file name with the current partial word If there is no command or file name with the current partial word
as its prefix, a bell character is output (usually causing a beep to be as its prefix, a bell character is output (usually causing a beep to be
sounded). sounded).
.It complete\-command: ^X^[ .It complete\-command: \*(haX\*(ha[
Automatically completes as much as is unique of the command name having the Automatically completes as much as is unique of the command name having the
partial word up to the cursor as its prefix, as in the partial word up to the cursor as its prefix, as in the
.Ic complete .Ic complete
command above. command above.
.It complete\-file: ^[^X .It complete\-file: \*(ha[\*(haX
Automatically completes as much as is unique of the file name having the Automatically completes as much as is unique of the file name having the
partial word up to the cursor as its prefix, as in the partial word up to the cursor as its prefix, as in the
.Ic complete .Ic complete
command described above. command described above.
.It complete\-list: ^I, ^[= .It complete\-list: \*(haI, \*(ha[=
Complete as much as is possible of the current word, Complete as much as is possible of the current word,
and list the possible completions for it. and list the possible completions for it.
If only one completion is possible, If only one completion is possible,
match as in the match as in the
.Ic complete .Ic complete
command above. command above.
Note that ^I is usually generated by the TAB (tabulator) key. Note that \*(haI is usually generated by the TAB (tabulator) key.
.It Xo delete\-char\-backward: .It Xo delete\-char\-backward:
.Op Ar n .Op Ar n
.No ERASE , ^? , ^H .No ERASE , \*(ha? , \*(haH
.Xc .Xc
Deletes Deletes
.Ar n .Ar n
@ -4566,21 +4586,21 @@ Deletes
characters after the cursor. characters after the cursor.
.It Xo delete\-word\-backward: .It Xo delete\-word\-backward:
.Op Ar n .Op Ar n
.No ERASE , ^[^? , ^[^H , ^[h .No ERASE , \*(ha[\*(ha? , \*(ha[\*(haH , \*(ha[h
.Xc .Xc
Deletes Deletes
.Ar n .Ar n
words before the cursor. words before the cursor.
.It Xo delete\-word\-forward: .It Xo delete\-word\-forward:
.Op Ar n .Op Ar n
.No ^[d .No \*(ha[d
.Xc .Xc
Deletes characters after the cursor up to the end of Deletes characters after the cursor up to the end of
.Ar n .Ar n
words. words.
.It Xo down\-history: .It Xo down\-history:
.Op Ar n .Op Ar n
.No ^N , ^XB .No \*(haN , \*(haXB
.Xc .Xc
Scrolls the history buffer forward Scrolls the history buffer forward
.Ar n .Ar n
@ -4595,21 +4615,21 @@ or
has been performed. has been performed.
.It Xo downcase\-word: .It Xo downcase\-word:
.Op Ar n .Op Ar n
.No ^[L , ^[l .No \*(ha[L , \*(ha[l
.Xc .Xc
Lowercases the next Lowercases the next
.Ar n .Ar n
words. words.
.It end\-of\-history: ^[\*(Gt .It end\-of\-history: \*(ha[\*(Gt
Moves to the end of the history. Moves to the end of the history.
.It end\-of\-line: ^E .It end\-of\-line: \*(haE
Moves the cursor to the end of the input line. Moves the cursor to the end of the input line.
.It eot: ^_ .It eot: \*(ha_
Acts as an end-of-file; this is useful because edit-mode input disables Acts as an end-of-file; this is useful because edit-mode input disables
normal terminal input canonicalization. normal terminal input canonicalization.
.It Xo eot\-or\-delete: .It Xo eot\-or\-delete:
.Op Ar n .Op Ar n
.No ^D .No \*(haD
.Xc .Xc
Acts as Acts as
.Ic eot .Ic eot
@ -4617,9 +4637,9 @@ if alone on a line; otherwise acts as
.Ic delete\-char\-forward . .Ic delete\-char\-forward .
.It error: (not bound) .It error: (not bound)
Error (ring the bell). Error (ring the bell).
.It exchange\-point\-and\-mark: ^X^X .It exchange\-point\-and\-mark: \*(haX\*(haX
Places the cursor where the mark is and sets the mark to where the cursor was. Places the cursor where the mark is and sets the mark to where the cursor was.
.It expand\-file: ^[* .It expand\-file: \*(ha[*
Appends a Appends a
.Ql * .Ql *
to the current word and replaces the word with the result of performing file to the current word and replaces the word with the result of performing file
@ -4627,55 +4647,55 @@ globbing on the word.
If no files match the pattern, the bell is rung. If no files match the pattern, the bell is rung.
.It Xo forward\-char: .It Xo forward\-char:
.Op Ar n .Op Ar n
.No ^F , ^XC .No \*(haF , \*(haXC
.Xc .Xc
Moves the cursor forward Moves the cursor forward
.Ar n .Ar n
characters. characters.
.It Xo forward\-word: .It Xo forward\-word:
.Op Ar n .Op Ar n
.No ^[f .No \*(ha[f
.Xc .Xc
Moves the cursor forward to the end of the Moves the cursor forward to the end of the
.Ar n Ns th .Ar n Ns th
word. word.
.It Xo goto\-history: .It Xo goto\-history:
.Op Ar n .Op Ar n
.No ^[g .No \*(ha[g
.Xc .Xc
Goes to history number Goes to history number
.Ar n . .Ar n .
.It kill\-line: KILL .It kill\-line: KILL
Deletes the entire input line. Deletes the entire input line.
.It kill\-region: ^W .It kill\-region: \*(haW
Deletes the input between the cursor and the mark. Deletes the input between the cursor and the mark.
.It Xo kill\-to\-eol: .It Xo kill\-to\-eol:
.Op Ar n .Op Ar n
.No ^K .No \*(haK
.Xc .Xc
Deletes the input from the cursor to the end of the line if Deletes the input from the cursor to the end of the line if
.Ar n .Ar n
is not specified; otherwise deletes characters between the cursor and column is not specified; otherwise deletes characters between the cursor and column
.Ar n . .Ar n .
.It list: ^[? .It list: \*(ha[?
Prints a sorted, columnated list of command names or file names (if any) that Prints a sorted, columnated list of command names or file names (if any) that
can complete the partial word containing the cursor. can complete the partial word containing the cursor.
Directory names have Directory names have
.Ql / .Ql /
appended to them. appended to them.
.It list\-command: ^X? .It list\-command: \*(haX?
Prints a sorted, columnated list of command names (if any) that can complete Prints a sorted, columnated list of command names (if any) that can complete
the partial word containing the cursor. the partial word containing the cursor.
.It list\-file: ^X^Y .It list\-file: \*(haX\*(haY
Prints a sorted, columnated list of file names (if any) that can complete the Prints a sorted, columnated list of file names (if any) that can complete the
partial word containing the cursor. partial word containing the cursor.
File type indicators are appended as described under File type indicators are appended as described under
.Ic list .Ic list
above. above.
.It newline: ^J , ^M .It newline: \*(haJ , \*(haM
Causes the current input line to be processed by the shell. Causes the current input line to be processed by the shell.
The current cursor position may be anywhere on the line. The current cursor position may be anywhere on the line.
.It newline\-and\-next: ^O .It newline\-and\-next: \*(haO
Causes the current input line to be processed by the shell, and the next line Causes the current input line to be processed by the shell, and the next line
from history becomes the current line. from history becomes the current line.
This is only useful after an This is only useful after an
@ -4684,42 +4704,42 @@ or
.Ic search\-history . .Ic search\-history .
.It no\-op: QUIT .It no\-op: QUIT
This does nothing. This does nothing.
.It prefix\-1: ^[ .It prefix\-1: \*(ha[
Introduces a 2-character command sequence. Introduces a 2-character command sequence.
.It prefix\-2: ^X , ^[[ , ^[O .It prefix\-2: \*(haX , \*(ha[[ , \*(ha[O
Introduces a 2-character command sequence. Introduces a 2-character command sequence.
.It Xo prev\-hist\-word: .It Xo prev\-hist\-word:
.Op Ar n .Op Ar n
.No ^[. , ^[_ .No \*(ha[. , \*(ha[_
.Xc .Xc
The last The last
.Pq Ar n Ns th .Pq Ar n Ns th
word of the previous command is inserted at the cursor. word of the previous command is inserted at the cursor.
.It quote: ^^ , ^V .It quote: \*(ha\*(ha , \*(haV
The following character is taken literally rather than as an editing command. The following character is taken literally rather than as an editing command.
.It redraw: ^L .It redraw: \*(haL
Reprints the last line of the prompt string and the current input line Reprints the last line of the prompt string and the current input line
on a new line. on a new line.
.It Xo search\-character\-backward: .It Xo search\-character\-backward:
.Op Ar n .Op Ar n
.No ^[^] .No \*(ha[\*(ha]
.Xc .Xc
Search backward in the current line for the Search backward in the current line for the
.Ar n Ns th .Ar n Ns th
occurrence of the next character typed. occurrence of the next character typed.
.It Xo search\-character\-forward: .It Xo search\-character\-forward:
.Op Ar n .Op Ar n
.No ^] .No \*(ha]
.Xc .Xc
Search forward in the current line for the Search forward in the current line for the
.Ar n Ns th .Ar n Ns th
occurrence of the next character typed. occurrence of the next character typed.
.It search\-history: ^R .It search\-history: \*(haR
Enter incremental search mode. Enter incremental search mode.
The internal history list is searched The internal history list is searched
backwards for commands matching the input. backwards for commands matching the input.
An initial An initial
.Ql ^ .Ql \*(ha
in the search string anchors the search. in the search string anchors the search.
The escape key will leave search mode. The escape key will leave search mode.
Other commands will be executed after leaving search mode. Other commands will be executed after leaving search mode.
@ -4729,9 +4749,9 @@ commands continue searching backward to the next previous occurrence of the
pattern. pattern.
The history buffer retains only a finite number of lines; the oldest The history buffer retains only a finite number of lines; the oldest
are discarded as necessary. are discarded as necessary.
.It set\-mark\-command: ^[ Ns Aq space .It set\-mark\-command: \*(ha[ Ns Aq space
Set the mark at the cursor position. Set the mark at the cursor position.
.It transpose\-chars: ^T .It transpose\-chars: \*(haT
If at the end of line, or if the If at the end of line, or if the
.Ic gmacs .Ic gmacs
option is set, this exchanges the two previous characters; otherwise, it option is set, this exchanges the two previous characters; otherwise, it
@ -4739,26 +4759,26 @@ exchanges the previous and current characters and moves the cursor one
character to the right. character to the right.
.It Xo up\-history: .It Xo up\-history:
.Op Ar n .Op Ar n
.No ^P , ^XA .No \*(haP , \*(haXA
.Xc .Xc
Scrolls the history buffer backward Scrolls the history buffer backward
.Ar n .Ar n
lines (earlier). lines (earlier).
.It Xo upcase\-word: .It Xo upcase\-word:
.Op Ar n .Op Ar n
.No ^[U , ^[u .No \*(ha[U , \*(ha[u
.Xc .Xc
Uppercase the next Uppercase the next
.Ar n .Ar n
words. words.
.It version: ^[^V .It version: \*(ha[\*(haV
Display the version of Display the version of
.Nm mksh . .Nm mksh .
The current edit buffer is restored as soon as a key is pressed. The current edit buffer is restored as soon as a key is pressed.
The restoring keypress is processed, unless it is a space. The restoring keypress is processed, unless it is a space.
.It yank: ^Y .It yank: \*(haY
Inserts the most recently killed text string at the current cursor position. Inserts the most recently killed text string at the current cursor position.
.It yank\-pop: ^[y .It yank\-pop: \*(ha[y
Immediately after a Immediately after a
.Ic yank , .Ic yank ,
replaces the inserted text string with the next previously killed text string. replaces the inserted text string with the next previously killed text string.
@ -4774,7 +4794,7 @@ editor with the following exceptions:
You start out in insert mode. You start out in insert mode.
.It .It
There are file name and command completion commands: There are file name and command completion commands:
=, \e, *, ^X, ^E, ^F, and, optionally, =, \e, *, \*(haX, \*(haE, \*(haF, and, optionally,
.Aq tab .Aq tab
and and
.Aq esc . .Aq esc .
@ -4818,34 +4838,34 @@ In particular, the following characters are taken from current
settings settings
(see (see
.Xr stty 1 ) .Xr stty 1 )
and have their usual meaning (normal values are in parentheses): kill (^U), and have their usual meaning (normal values are in parentheses): kill (\*(haU),
erase (^?), werase (^W), eof (^D), intr (^C), and quit (^\e). erase (\*(ha?), werase (\*(haW), eof (\*(haD), intr (\*(haC), and quit (\*(ha\e).
In addition to In addition to
the above, the following characters are also treated specially in insert mode: the above, the following characters are also treated specially in insert mode:
.Bl -tag -width 10n .Bl -tag -width 10n
.It ^E .It \*(haE
Command and file name enumeration (see below). Command and file name enumeration (see below).
.It ^F .It \*(haF
Command and file name completion (see below). Command and file name completion (see below).
If used twice in a row, the If used twice in a row, the
list of possible completions is displayed; if used a third time, the completion list of possible completions is displayed; if used a third time, the completion
is undone. is undone.
.It ^H .It \*(haH
Erases previous character. Erases previous character.
.It ^J \*(Ba ^M .It \*(haJ \*(Ba \*(haM
End of line. End of line.
The current line is read, parsed, and executed by the shell. The current line is read, parsed, and executed by the shell.
.It ^V .It \*(haV
Literal next. Literal next.
The next character typed is not treated specially (can be used The next character typed is not treated specially (can be used
to insert the characters being described here). to insert the characters being described here).
.It ^X .It \*(haX
Command and file name expansion (see below). Command and file name expansion (see below).
.It Aq esc .It Aq esc
Puts the editor in command mode (see below). Puts the editor in command mode (see below).
.It Aq tab .It Aq tab
Optional file name and command completion (see Optional file name and command completion (see
.Ic ^F .Ic \*(haF
above), enabled with above), enabled with
.Ic set \-o vi\-tabcomplete . .Ic set \-o vi\-tabcomplete .
.El .El
@ -4869,7 +4889,7 @@ A
.Dq word .Dq word
is a sequence of letters, digits, and underscore characters or a sequence of is a sequence of letters, digits, and underscore characters or a sequence of
non-letter, non-digit, non-underscore, and non-whitespace characters (e.g.\& non-letter, non-digit, non-underscore, and non-whitespace characters (e.g.\&
.Dq ab2*&^ .Dq ab2*&\*(ha
contains two words) and a contains two words) and a
.Dq big-word .Dq big-word
is a sequence of non-whitespace characters. is a sequence of non-whitespace characters.
@ -4895,7 +4915,7 @@ Insert the comment character
.Pq Sq # .Pq Sq #
at the start of the current line and return the line to the shell (equivalent at the start of the current line and return the line to the shell (equivalent
to to
.Ic I#^J ) . .Ic I#\*(haJ ) .
.It Xo .It Xo
.Oo Ar n Oc Ns g .Oo Ar n Oc Ns g
.Xc .Xc
@ -4916,11 +4936,11 @@ editor; if
is not specified, the current line is edited. is not specified, the current line is edited.
The actual command executed is The actual command executed is
.Ic fc \-e ${VISUAL:\-${EDITOR:\-vi}} Ar n . .Ic fc \-e ${VISUAL:\-${EDITOR:\-vi}} Ar n .
.It * and ^X .It * and \*(haX
Command or file name expansion is applied to the current big-word (with an Command or file name expansion is applied to the current big-word (with an
appended appended
.Ql * .Ql *
if the word contains no file globbing characters) \(em the big-word is replaced if the word contains no file globbing characters) \*(en the big-word is replaced
with the resulting words. with the resulting words.
If the current big-word is the first on the line (or If the current big-word is the first on the line (or
follows one of the following characters: follows one of the following characters:
@ -4944,7 +4964,7 @@ After expansion, the cursor is placed just past the last
word and the editor is in insert mode. word and the editor is in insert mode.
.It Xo .It Xo
.Oo Ar n Oc Ns \e , .Oo Ar n Oc Ns \e ,
.Oo Ar n Oc Ns ^F , .Oo Ar n Oc Ns \*(haF ,
.Oo Ar n Oc Ns Aq tab , .Oo Ar n Oc Ns Aq tab ,
.No and .No and
.Oo Ar n Oc Ns Aq esc .Oo Ar n Oc Ns Aq esc
@ -4967,10 +4987,10 @@ is specified, the
.Ar n Ns th .Ar n Ns th
possible completion is selected (as reported by the command/file name possible completion is selected (as reported by the command/file name
enumeration command). enumeration command).
.It = and ^E .It = and \*(haE
Command/file name enumeration. Command/file name enumeration.
List all the commands or files that match the current big-word. List all the commands or files that match the current big-word.
.It ^V .It \*(haV
Display the version of Display the version of
.Nm mksh . .Nm mksh .
The current edit buffer is restored as soon as a key is pressed. The current edit buffer is restored as soon as a key is pressed.
@ -4985,7 +5005,7 @@ Intra-line movement commands:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Xo .It Xo
.Oo Ar n Oc Ns h and .Oo Ar n Oc Ns h and
.Oo Ar n Oc Ns ^H .Oo Ar n Oc Ns \*(haH
.Xc .Xc
Move left Move left
.Ar n .Ar n
@ -4999,7 +5019,7 @@ Move right
characters. characters.
.It 0 .It 0
Move to column 0. Move to column 0.
.It ^ .It \*(ha
Move to the first non-whitespace character. Move to the first non-whitespace character.
.It Xo .It Xo
.Oo Ar n Oc Ns \*(Ba .Oo Ar n Oc Ns \*(Ba
@ -5100,7 +5120,7 @@ Inter-line movement commands:
.Oo Ar n Oc Ns j , .Oo Ar n Oc Ns j ,
.Oo Ar n Oc Ns + , .Oo Ar n Oc Ns + ,
.No and .No and
.Oo Ar n Oc Ns ^N .Oo Ar n Oc Ns \*(haN
.Xc .Xc
Move to the Move to the
.Ar n Ns th .Ar n Ns th
@ -5109,7 +5129,7 @@ next line in the history.
.Oo Ar n Oc Ns k , .Oo Ar n Oc Ns k ,
.Oo Ar n Oc Ns \- , .Oo Ar n Oc Ns \- ,
.No and .No and
.Oo Ar n Oc Ns ^P .Oo Ar n Oc Ns \*(haP
.Xc .Xc
Move to the Move to the
.Ar n Ns th .Ar n Ns th
@ -5140,7 +5160,7 @@ line containing
if if
.Ar string .Ar string
starts with starts with
.Ql ^ , .Ql \*(ha ,
the remainder of the string must appear at the start of the history line for the remainder of the string must appear at the start of the history line for
it to match. it to match.
.It Xo .It Xo
@ -5262,7 +5282,7 @@ The replacement is repeated
.Ar n .Ar n
times. times.
.It Xo .It Xo
.Oo Ar n Oc Ns ~ .Oo Ar n Oc Ns \*(TI
.Xc .Xc
Change the case of the next Change the case of the next
.Ar n .Ar n
@ -5295,9 +5315,9 @@ except the buffer is pasted at the current position.
.Pp .Pp
Miscellaneous vi commands Miscellaneous vi commands
.Bl -tag -width Ds .Bl -tag -width Ds
.It ^J and ^M .It \*(haJ and \*(haM
The current line is read, parsed, and executed by the shell. The current line is read, parsed, and executed by the shell.
.It ^L and ^R .It \*(haL and \*(haR
Redraw the current line. Redraw the current line.
.It Xo .It Xo
.Oo Ar n Oc Ns \&. .Oo Ar n Oc Ns \&.
@ -5315,12 +5335,12 @@ deleted and a new prompt to be printed.
.El .El
.Sh FILES .Sh FILES
.Bl -tag -width "/etc/suid_profileXX" -compact .Bl -tag -width "/etc/suid_profileXX" -compact
.It Pa ~/.mkshrc .It Pa \*(TI/.mkshrc
User's startup script (interactive shells). User's startup script (interactive shells).
Used only if Used only if
.Ev ENV .Ev ENV
is unset or empty. is unset or empty.
.It Pa ~/.profile .It Pa \*(TI/.profile
User's login profile. User's login profile.
.It Pa /etc/profile .It Pa /etc/profile
System login profile. System login profile.
@ -5391,7 +5411,7 @@ Privileged shell profile.
.Re .Re
.Rs .Rs
.%A "IEEE Inc." .%A "IEEE Inc."
.%B "IEEE Standard for Information Technology \(em Portable Operating System Interface (POSIX)" .%B "IEEE Standard for Information Technology \*(en Portable Operating System Interface (POSIX)"
.%V "Part 2: Shell and Utilities" .%V "Part 2: Shell and Utilities"
.%D 1993 .%D 1993
.%I "IEEE Press" .%I "IEEE Press"
@ -5440,7 +5460,7 @@ for an operating environment supporting all of its advanced needs.
Please report bugs in Please report bugs in
.Nm .Nm
to the to the
.Aq miros-discuss@mirbsd.org .Aq miros\-discuss@mirbsd.org
mailing list or in the mailing list or in the
.Li \&#\&!/bin/mksh .Li \&#\&!/bin/mksh
.Pq or Li \&#ksh .Pq or Li \&#ksh