|
Packit |
7cfc04 |
'\" et
|
|
Packit |
7cfc04 |
.TH FC "1P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH PROLOG
|
|
Packit |
7cfc04 |
This manual page is part of the POSIX Programmer's Manual.
|
|
Packit |
7cfc04 |
The Linux implementation of this interface may differ (consult
|
|
Packit |
7cfc04 |
the corresponding Linux manual page for details of Linux behavior),
|
|
Packit |
7cfc04 |
or the interface may not be implemented on Linux.
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
fc
|
|
Packit |
7cfc04 |
\(em process the command history list
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
fc \fB[\fR\(mir\fB] [\fR\(mie \fIeditor\fB] [\fIfirst \fB[\fIlast\fB]]\fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
fc \(mil\fB [\fR\(minr\fB] [\fIfirst \fB[\fIlast\fB]]\fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
fc \(mis\fB [\fIold\fR=\fInew\fB] [\fIfirst\fB]\fR
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
utility shall list, or shall edit and re-execute, commands previously
|
|
Packit |
7cfc04 |
entered to an interactive
|
|
Packit |
7cfc04 |
.IR sh .
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The command history list shall reference commands by number. The first
|
|
Packit |
7cfc04 |
number in the list is selected arbitrarily. The relationship of a
|
|
Packit |
7cfc04 |
number to its command shall not change except when the user logs in and
|
|
Packit |
7cfc04 |
no other process is accessing the list, at which time the system may
|
|
Packit |
7cfc04 |
reset the numbering to start the oldest retained command at another
|
|
Packit |
7cfc04 |
number (usually 1). When the number reaches an
|
|
Packit |
7cfc04 |
implementation-defined upper limit, which shall be no smaller than
|
|
Packit |
7cfc04 |
the value in
|
|
Packit |
7cfc04 |
.IR HISTSIZE
|
|
Packit |
7cfc04 |
or 32\|767 (whichever is greater), the shell may wrap the numbers,
|
|
Packit |
7cfc04 |
starting the next command with a lower number (usually 1). However,
|
|
Packit |
7cfc04 |
despite this optional wrapping of numbers,
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
shall maintain the time-ordering sequence of the commands. For
|
|
Packit |
7cfc04 |
example, if four commands in sequence are given the numbers 32\|766,
|
|
Packit |
7cfc04 |
32\|767, 1 (wrapped), and 2 as they are executed, command 32\|767 is
|
|
Packit |
7cfc04 |
considered the command previous to 1, even though its number is
|
|
Packit |
7cfc04 |
higher.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
When commands are edited (when the
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
option is not specified), the resulting lines shall be entered at the
|
|
Packit |
7cfc04 |
end of the history list and then re-executed by
|
|
Packit |
7cfc04 |
.IR sh .
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
command that caused the editing shall not be entered into the history
|
|
Packit |
7cfc04 |
list. If the editor returns a non-zero exit status, this shall
|
|
Packit |
7cfc04 |
suppress the entry into the history list and the command re-execution.
|
|
Packit |
7cfc04 |
Any command line variable assignments or redirection operators used
|
|
Packit |
7cfc04 |
with
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
shall affect both the
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
command itself as well as the command that results; for example:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
fc \(mis \(mi\|\(mi \(mi1 2>/dev/null
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
reinvokes the previous command, suppressing standard error for both
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
and the previous command.
|
|
Packit |
7cfc04 |
.SH OPTIONS
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
utility shall conform to the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines".
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The following options shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fB\(mie\ \fIeditor\fR" 10
|
|
Packit |
7cfc04 |
Use the editor named by
|
|
Packit |
7cfc04 |
.IR editor
|
|
Packit |
7cfc04 |
to edit the commands. The
|
|
Packit |
7cfc04 |
.IR editor
|
|
Packit |
7cfc04 |
string is a utility name, subject to search via the
|
|
Packit |
7cfc04 |
.IR PATH
|
|
Packit |
7cfc04 |
variable (see the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Chapter 8" ", " "Environment Variables").
|
|
Packit |
7cfc04 |
The value in the
|
|
Packit |
7cfc04 |
.IR FCEDIT
|
|
Packit |
7cfc04 |
variable shall be used as a default when
|
|
Packit |
7cfc04 |
.BR \(mie
|
|
Packit |
7cfc04 |
is not specified. If
|
|
Packit |
7cfc04 |
.IR FCEDIT
|
|
Packit |
7cfc04 |
is null or unset,
|
|
Packit |
7cfc04 |
.IR ed
|
|
Packit |
7cfc04 |
shall be used as the editor.
|
|
Packit |
7cfc04 |
.IP "\fB\(mil\fP" 10
|
|
Packit |
7cfc04 |
(The letter ell.) List the commands rather than invoking an editor on
|
|
Packit |
7cfc04 |
them. The commands shall be written in the sequence indicated by the
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
operands, as affected by
|
|
Packit |
7cfc04 |
.BR \(mir ,
|
|
Packit |
7cfc04 |
with each command preceded by the command number.
|
|
Packit |
7cfc04 |
.IP "\fB\(min\fP" 10
|
|
Packit |
7cfc04 |
Suppress command numbers when listing with
|
|
Packit |
7cfc04 |
.BR \(mil .
|
|
Packit |
7cfc04 |
.IP "\fB\(mir\fP" 10
|
|
Packit |
7cfc04 |
Reverse the order of the commands listed (with
|
|
Packit |
7cfc04 |
.BR \(mil )
|
|
Packit |
7cfc04 |
or edited (with neither
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
nor
|
|
Packit |
7cfc04 |
.BR \(mis ).
|
|
Packit |
7cfc04 |
.IP "\fB\(mis\fP" 10
|
|
Packit |
7cfc04 |
Re-execute the command without invoking an editor.
|
|
Packit |
7cfc04 |
.SH OPERANDS
|
|
Packit |
7cfc04 |
The following operands shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fIfirst\fR,\ \fIlast\fR" 10
|
|
Packit |
7cfc04 |
Select the commands to list or edit. The number of previous commands
|
|
Packit |
7cfc04 |
that can be accessed shall be determined by the value of the
|
|
Packit |
7cfc04 |
.IR HISTSIZE
|
|
Packit |
7cfc04 |
variable. The value of
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
or both shall be one of the following:
|
|
Packit |
7cfc04 |
.RS 10
|
|
Packit |
7cfc04 |
.IP "\fB[+]\fInumber\fR" 10
|
|
Packit |
7cfc04 |
A positive number representing a command number; command numbers can be
|
|
Packit |
7cfc04 |
displayed with the
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
option.
|
|
Packit |
7cfc04 |
.IP "\fB\(mi\fInumber\fR" 10
|
|
Packit |
7cfc04 |
A negative decimal number representing the command that was executed
|
|
Packit |
7cfc04 |
.IR number
|
|
Packit |
7cfc04 |
of commands previously. For example, \(mi1 is the immediately previous
|
|
Packit |
7cfc04 |
command.
|
|
Packit |
7cfc04 |
.IP "\fIstring\fR" 10
|
|
Packit |
7cfc04 |
A string indicating the most recently entered command that begins with
|
|
Packit |
7cfc04 |
that string. If the
|
|
Packit |
7cfc04 |
.IR old =\c
|
|
Packit |
7cfc04 |
.IR new
|
|
Packit |
7cfc04 |
operand is not also specified with
|
|
Packit |
7cfc04 |
.BR \(mis ,
|
|
Packit |
7cfc04 |
the string form of the
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
operand cannot contain an embedded
|
|
Packit |
7cfc04 |
<equals-sign>.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
When the synopsis form with
|
|
Packit |
7cfc04 |
.BR \(mis
|
|
Packit |
7cfc04 |
is used:
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
is omitted, the previous command shall be used.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
For the synopsis forms without
|
|
Packit |
7cfc04 |
.BR \(mis :
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
is omitted,
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
shall default to the previous command when
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
is specified; otherwise, it shall default to
|
|
Packit |
7cfc04 |
.IR first .
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
are both omitted, the previous 16 commands shall be listed or the
|
|
Packit |
7cfc04 |
previous single command shall be edited (based on the
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
option).
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
If
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
are both present, all of the commands from
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
shall be edited (without
|
|
Packit |
7cfc04 |
.BR \(mil )
|
|
Packit |
7cfc04 |
or listed (with
|
|
Packit |
7cfc04 |
.BR \(mil ).
|
|
Packit |
7cfc04 |
Editing multiple commands shall be accomplished by presenting to the
|
|
Packit |
7cfc04 |
editor all of the commands at one time, each command starting on a new
|
|
Packit |
7cfc04 |
line. If
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
represents a newer command than
|
|
Packit |
7cfc04 |
.IR last ,
|
|
Packit |
7cfc04 |
the commands shall be listed or edited in reverse sequence, equivalent
|
|
Packit |
7cfc04 |
to using
|
|
Packit |
7cfc04 |
.BR \(mir .
|
|
Packit |
7cfc04 |
For example, the following commands on the first line are equivalent to
|
|
Packit |
7cfc04 |
the corresponding commands on the second:
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
fc \(mir 10 20 fc 30 40
|
|
Packit |
7cfc04 |
fc 20 10 fc \(mir 40 30
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP " *" 4
|
|
Packit |
7cfc04 |
When a range of commands is used, it shall not be an error to specify
|
|
Packit |
7cfc04 |
.IR first
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR last
|
|
Packit |
7cfc04 |
values that are not in the history list;
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
shall substitute the value representing the oldest or newest command in
|
|
Packit |
7cfc04 |
the list, as appropriate. For example, if there are only ten commands
|
|
Packit |
7cfc04 |
in the history list, numbered 1 to 10:
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
fc \(mil
|
|
Packit |
7cfc04 |
fc 1 99
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
shall list and edit, respectively, all ten commands.
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP "\fIold\fP=\fInew\fR" 10
|
|
Packit |
7cfc04 |
Replace the first occurrence of string
|
|
Packit |
7cfc04 |
.IR old
|
|
Packit |
7cfc04 |
in the commands to be re-executed by the string
|
|
Packit |
7cfc04 |
.IR new .
|
|
Packit |
7cfc04 |
.SH STDIN
|
|
Packit |
7cfc04 |
Not used.
|
|
Packit |
7cfc04 |
.SH "INPUT FILES"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "ENVIRONMENT VARIABLES"
|
|
Packit |
7cfc04 |
The following environment variables shall affect the execution of
|
|
Packit |
7cfc04 |
.IR fc :
|
|
Packit |
7cfc04 |
.IP "\fIFCEDIT\fP" 10
|
|
Packit |
7cfc04 |
This variable, when expanded by the shell, shall determine the default
|
|
Packit |
7cfc04 |
value for the
|
|
Packit |
7cfc04 |
.BR \(mie
|
|
Packit |
7cfc04 |
.IR editor
|
|
Packit |
7cfc04 |
option's
|
|
Packit |
7cfc04 |
.IR editor
|
|
Packit |
7cfc04 |
option-argument. If
|
|
Packit |
7cfc04 |
.IR FCEDIT
|
|
Packit |
7cfc04 |
is null or unset,
|
|
Packit |
7cfc04 |
.IR ed
|
|
Packit |
7cfc04 |
shall be used as the editor.
|
|
Packit |
7cfc04 |
.IP "\fIHISTFILE\fP" 10
|
|
Packit |
7cfc04 |
Determine a pathname naming a command history file. If the
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
variable is not set, the shell may attempt to access or create a file
|
|
Packit |
7cfc04 |
.BR .sh_history
|
|
Packit |
7cfc04 |
in the directory referred to by the
|
|
Packit |
7cfc04 |
.IR HOME
|
|
Packit |
7cfc04 |
environment variable. If the shell cannot obtain both read and write
|
|
Packit |
7cfc04 |
access to, or create, the history file, it shall use an unspecified
|
|
Packit |
7cfc04 |
mechanism that allows the history to operate properly. (References to
|
|
Packit |
7cfc04 |
history ``file'' in this section shall be understood to mean this
|
|
Packit |
7cfc04 |
unspecified mechanism in such cases.) An implementation may choose to
|
|
Packit |
7cfc04 |
access this variable only when initializing the history file; this
|
|
Packit |
7cfc04 |
initialization shall occur when
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR sh
|
|
Packit |
7cfc04 |
first attempt to retrieve entries from, or add entries to, the file, as
|
|
Packit |
7cfc04 |
the result of commands issued by the user, the file named by the
|
|
Packit |
7cfc04 |
.IR ENV
|
|
Packit |
7cfc04 |
variable, or implementation-defined system start-up files. In some
|
|
Packit |
7cfc04 |
historical shells, the history file is initialized just after the
|
|
Packit |
7cfc04 |
.IR ENV
|
|
Packit |
7cfc04 |
file has been processed. Therefore, it is implementation-defined
|
|
Packit |
7cfc04 |
whether changes made to
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
after the history file has been initialized are effective.
|
|
Packit |
7cfc04 |
Implementations may choose to disable the history list mechanism for
|
|
Packit |
7cfc04 |
users with appropriate privileges who do not set
|
|
Packit |
7cfc04 |
.IR HISTFILE ;
|
|
Packit |
7cfc04 |
the specific circumstances under which this occurs are
|
|
Packit |
7cfc04 |
implementation-defined. If more than one instance of the shell is
|
|
Packit |
7cfc04 |
using the same history file, it is unspecified how updates to the
|
|
Packit |
7cfc04 |
history file from those shells interact. As entries are deleted from
|
|
Packit |
7cfc04 |
the history file, they shall be deleted oldest first. It is
|
|
Packit |
7cfc04 |
unspecified when history file entries are physically removed from the
|
|
Packit |
7cfc04 |
history file.
|
|
Packit |
7cfc04 |
.IP "\fIHISTSIZE\fP" 10
|
|
Packit |
7cfc04 |
Determine a decimal number representing the limit to the number of
|
|
Packit |
7cfc04 |
previous commands that are accessible. If this variable is unset, an
|
|
Packit |
7cfc04 |
unspecified default greater than or equal to 128 shall be used. The
|
|
Packit |
7cfc04 |
maximum number of commands in the history list is unspecified, but
|
|
Packit |
7cfc04 |
shall be at least 128. An implementation may choose to access this
|
|
Packit |
7cfc04 |
variable only when initializing the history file, as described under
|
|
Packit |
7cfc04 |
.IR HISTFILE .
|
|
Packit |
7cfc04 |
Therefore, it is unspecified whether changes made to
|
|
Packit |
7cfc04 |
.IR HISTSIZE
|
|
Packit |
7cfc04 |
after the history file has been initialized are effective.
|
|
Packit |
7cfc04 |
.IP "\fILANG\fP" 10
|
|
Packit |
7cfc04 |
Provide a default value for the internationalization variables that are
|
|
Packit |
7cfc04 |
unset or null. (See the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 8.2" ", " "Internationalization Variables"
|
|
Packit |
7cfc04 |
for the precedence of internationalization variables used to determine
|
|
Packit |
7cfc04 |
the values of locale categories.)
|
|
Packit |
7cfc04 |
.IP "\fILC_ALL\fP" 10
|
|
Packit |
7cfc04 |
If set to a non-empty string value, override the values of all the
|
|
Packit |
7cfc04 |
other internationalization variables.
|
|
Packit |
7cfc04 |
.IP "\fILC_CTYPE\fP" 10
|
|
Packit |
7cfc04 |
Determine the locale for the interpretation of sequences of bytes of
|
|
Packit |
7cfc04 |
text data as characters (for example, single-byte as opposed to
|
|
Packit |
7cfc04 |
multi-byte characters in arguments and input files).
|
|
Packit |
7cfc04 |
.IP "\fILC_MESSAGES\fP" 10
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Determine the locale that should be used to affect the format and
|
|
Packit |
7cfc04 |
contents of diagnostic messages written to standard error.
|
|
Packit |
7cfc04 |
.IP "\fINLSPATH\fP" 10
|
|
Packit |
7cfc04 |
Determine the location of message catalogs for the processing of
|
|
Packit |
7cfc04 |
.IR LC_MESSAGES .
|
|
Packit |
7cfc04 |
.SH "ASYNCHRONOUS EVENTS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.SH STDOUT
|
|
Packit |
7cfc04 |
When the
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
option is used to list commands, the format of each command in the list
|
|
Packit |
7cfc04 |
shall be as follows:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"%d\et%s\en", <\fIline number\fR>, <\fIcommand\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If both the
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR \(min
|
|
Packit |
7cfc04 |
options are specified, the format of each command shall be:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"\et%s\en", <\fIcommand\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the <\fIcommand\fP> consists of more than one line, the lines after
|
|
Packit |
7cfc04 |
the first shall be displayed as:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
"\et%s\en", <\fIcontinued-command\fR>
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.SH STDERR
|
|
Packit |
7cfc04 |
The standard error shall be used only for diagnostic messages.
|
|
Packit |
7cfc04 |
.SH "OUTPUT FILES"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "EXTENDED DESCRIPTION"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "EXIT STATUS"
|
|
Packit |
7cfc04 |
The following exit values shall be returned:
|
|
Packit |
7cfc04 |
.IP "\00" 6
|
|
Packit |
7cfc04 |
Successful completion of the listing.
|
|
Packit |
7cfc04 |
.IP >0 6
|
|
Packit |
7cfc04 |
An error occurred.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Otherwise, the exit status shall be that of the commands executed by
|
|
Packit |
7cfc04 |
.IR fc .
|
|
Packit |
7cfc04 |
.SH "CONSEQUENCES OF ERRORS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.IR "The following sections are informative."
|
|
Packit |
7cfc04 |
.SH "APPLICATION USAGE"
|
|
Packit |
7cfc04 |
Since editors sometimes use file descriptors as integral parts of their
|
|
Packit |
7cfc04 |
editing, redirecting their file descriptors as part of the
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
command can produce unexpected results. For example, if
|
|
Packit |
7cfc04 |
.IR vi
|
|
Packit |
7cfc04 |
is the
|
|
Packit |
7cfc04 |
.IR FCEDIT
|
|
Packit |
7cfc04 |
editor, the command:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
fc \(mis | more
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
does not work correctly on many systems.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Users on windowing systems may want to have separate history files for
|
|
Packit |
7cfc04 |
each window by setting
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
as follows:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
HISTFILE=$HOME/.sh_hist$$
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.SH "EXAMPLES"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH RATIONALE
|
|
Packit |
7cfc04 |
This utility is based on the
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
built-in of the KornShell.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
An early proposal specified the
|
|
Packit |
7cfc04 |
.BR \(mie
|
|
Packit |
7cfc04 |
option as
|
|
Packit |
7cfc04 |
.BR [\(mie
|
|
Packit |
7cfc04 |
.IR editor
|
|
Packit |
7cfc04 |
.BR [ \c
|
|
Packit |
7cfc04 |
.IR old \c
|
|
Packit |
7cfc04 |
=
|
|
Packit |
7cfc04 |
.IR new
|
|
Packit |
7cfc04 |
.BR ]\|] ,
|
|
Packit |
7cfc04 |
which is not historical practice. Historical practice in
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
of either
|
|
Packit |
7cfc04 |
.BR [\(mie
|
|
Packit |
7cfc04 |
.IR editor \c
|
|
Packit |
7cfc04 |
.BR ]
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR "[\(mie \(mi ["
|
|
Packit |
7cfc04 |
.IR old \c
|
|
Packit |
7cfc04 |
=
|
|
Packit |
7cfc04 |
.IR new
|
|
Packit |
7cfc04 |
.BR ]\|]
|
|
Packit |
7cfc04 |
is acceptable, but not both together. To clarify this, a new option
|
|
Packit |
7cfc04 |
.BR \(mis
|
|
Packit |
7cfc04 |
was introduced replacing the
|
|
Packit |
7cfc04 |
.BR "[\(mie \(mi]" .
|
|
Packit |
7cfc04 |
This resolves the conflict and makes
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
conform to the Utility Syntax Guidelines.
|
|
Packit |
7cfc04 |
.IP "\fIHISTFILE\fP" 10
|
|
Packit |
7cfc04 |
Some implementations of the KornShell check for the superuser
|
|
Packit |
7cfc04 |
and do not create a history file unless
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
is set. This is done primarily to avoid creating unlinked files in the
|
|
Packit |
7cfc04 |
root file system when logging in during single-user mode.
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
must be set for the superuser to have history.
|
|
Packit |
7cfc04 |
.IP "\fIHISTSIZE\fP" 10
|
|
Packit |
7cfc04 |
Needed to limit the size of history files. It is the intent of the
|
|
Packit |
7cfc04 |
standard developers that when two shells share the same history file,
|
|
Packit |
7cfc04 |
commands that are entered in one shell shall be accessible by the other
|
|
Packit |
7cfc04 |
shell. Because of the difficulties of synchronization over a network,
|
|
Packit |
7cfc04 |
the exact nature of the interaction is unspecified.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The initialization process for the history file can be dependent on the
|
|
Packit |
7cfc04 |
system start-up files, in that they may contain commands that
|
|
Packit |
7cfc04 |
effectively preempt the settings the user has for
|
|
Packit |
7cfc04 |
.IR HISTFILE
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR HISTSIZE .
|
|
Packit |
7cfc04 |
For example, function definition commands are recorded in the history
|
|
Packit |
7cfc04 |
file. If the system administrator includes function definitions in some
|
|
Packit |
7cfc04 |
system start-up file called before the
|
|
Packit |
7cfc04 |
.IR ENV
|
|
Packit |
7cfc04 |
file, the history file is initialized before the user can influence its
|
|
Packit |
7cfc04 |
characteristics. In some historical shells, the history file is
|
|
Packit |
7cfc04 |
initialized just after the
|
|
Packit |
7cfc04 |
.IR ENV
|
|
Packit |
7cfc04 |
file has been processed. Because of these situations, the text requires
|
|
Packit |
7cfc04 |
the initialization process to be implementation-defined.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Consideration was given to omitting the
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
utility in favor of the command line editing feature in
|
|
Packit |
7cfc04 |
.IR sh .
|
|
Packit |
7cfc04 |
For example, in
|
|
Packit |
7cfc04 |
.IR vi
|
|
Packit |
7cfc04 |
editing mode, typing
|
|
Packit |
7cfc04 |
.BR \(dq<ESC> v\(dq
|
|
Packit |
7cfc04 |
is equivalent to:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
EDITOR=vi fc
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
However, the
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
utility allows the user the flexibility to edit multiple commands
|
|
Packit |
7cfc04 |
simultaneously (such as
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
10 20) and to use editors other than those supported by
|
|
Packit |
7cfc04 |
.IR sh
|
|
Packit |
7cfc04 |
for command line editing.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
In the KornShell, the alias
|
|
Packit |
7cfc04 |
.BR r
|
|
Packit |
7cfc04 |
(``re-do'') is preset to
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
.BR "\(mie \(mi"
|
|
Packit |
7cfc04 |
(equivalent to the POSIX
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
.BR \(mis ).
|
|
Packit |
7cfc04 |
This is probably an easier command name to remember than
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
(``fix command''), but it does not meet the Utility Syntax Guidelines.
|
|
Packit |
7cfc04 |
Renaming
|
|
Packit |
7cfc04 |
.IR fc
|
|
Packit |
7cfc04 |
to
|
|
Packit |
7cfc04 |
.IR hist
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR redo
|
|
Packit |
7cfc04 |
was considered, but since this description closely matches historical
|
|
Packit |
7cfc04 |
KornShell practice already, such a renaming was seen as gratuitous.
|
|
Packit |
7cfc04 |
Users are free to create aliases whenever odd historical names such as
|
|
Packit |
7cfc04 |
.IR fc ,
|
|
Packit |
7cfc04 |
.IR awk ,
|
|
Packit |
7cfc04 |
.IR cat ,
|
|
Packit |
7cfc04 |
.IR grep ,
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.IR yacc
|
|
Packit |
7cfc04 |
are standardized by POSIX.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Command numbers have no ordering effects; they are like serial numbers.
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR \(mir
|
|
Packit |
7cfc04 |
option and \(mi\fInumber\fP operand address the sequence of command
|
|
Packit |
7cfc04 |
execution, regardless of serial numbers. So, for example, if the
|
|
Packit |
7cfc04 |
command number wrapped back to 1 at some arbitrary point, there would
|
|
Packit |
7cfc04 |
be no ambiguity associated with traversing the wrap point. For example,
|
|
Packit |
7cfc04 |
if the command history were:
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
32766: echo 1
|
|
Packit |
7cfc04 |
32767: echo 2
|
|
Packit |
7cfc04 |
1: echo 3
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
the number \(mi2 refers to command 32\|767 because it is the second
|
|
Packit |
7cfc04 |
previous command, regardless of serial number.
|
|
Packit |
7cfc04 |
.SH "FUTURE DIRECTIONS"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "SEE ALSO"
|
|
Packit |
7cfc04 |
.IR "\fIsh\fR\^"
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Chapter 8" ", " "Environment Variables",
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines"
|
|
Packit |
7cfc04 |
.SH COPYRIGHT
|
|
Packit |
7cfc04 |
Portions of this text are reprinted and reproduced in electronic form
|
|
Packit |
7cfc04 |
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
|
|
Packit |
7cfc04 |
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Packit |
7cfc04 |
Specifications Issue 7, Copyright (C) 2013 by the Institute of
|
|
Packit |
7cfc04 |
Electrical and Electronics Engineers, Inc and The Open Group.
|
|
Packit |
7cfc04 |
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
|
|
Packit |
7cfc04 |
event of any discrepancy between this version and the original IEEE and
|
|
Packit |
7cfc04 |
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
Packit |
7cfc04 |
is the referee document. The original Standard can be obtained online at
|
|
Packit |
7cfc04 |
http://www.unix.org/online.html .
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
Any typographical or formatting errors that appear
|
|
Packit |
7cfc04 |
in this page are most likely
|
|
Packit |
7cfc04 |
to have been introduced during the conversion of the source files to
|
|
Packit |
7cfc04 |
man page format. To report such errors, see
|
|
Packit |
7cfc04 |
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|