.TH fc "" "" Command
.PC "Edit and re-execute one or more previous commands"
\fBfc [\-e \fIeditor\^\fB] [\-ln] [\fIfirst \fB[\fIlast\^\fB]]\fR
.\"\fBfc [\-e \fIeditor\^\fB] \- [\fIold\fB=\fInew\^\fB] [\fIcommand\^\fB]\fR"
.PP
.HS
.SH Options:
.IC \fB\-l\fR
Print commands on stdout
.IC "\fB\-e \fIeditor\fR"
Use \fIeditor\fR instead of the editor named in the evironmental variable
\fBFCEDIT\fR
.IC \fB\-n\fR
Suppress default command numbers
.Pp
\fBksh\fR only.
.HE
.BR fc ,
the ``fix command'', is a command built into the Korn shell
.BR ksh .
It permits you to edit and re-execute one or more commands that have
been executed previously.
.PP
.B fc
.\"works in either of the two forms summarized at the beginning of this article.
.\"In the first form,
.\".B fc
selects commands
.I first
through
.I last
and inserts them into a text editor.
You can edit the commands in the editor; exiting from the editor
re-executes the commands.
.I first
and
.I last
can be addressed either by the command's number (the first command issued
to the shell is number one, the second is number two, and so on), or by
a string that matches the beginning of the command.
When called without a
.I last
variable, the command selects just
.IR first .
Option \fB\-l\fR prints the commands on the standard output
rather than buffering the commands for editing and re-execution.
Option \fB\-n\fR suppresses the default command numbers.
.\".PP
.\"In its second form,
.\".B fc
.\"substitutes string \fInew\fR for string \fIold\fR within
.\".IR command ,
.\"then re-executes it.
.\".I command
.\"can be addressed either by its number or by a string that
.\"matches its beginning.
.\"If no
.\".I command
.\"is specified,
.\".B fc
.\"re-executes the previous command.
.PP
.B fc
uses the editor named in the environmental variable
.BR FCEDIT ;
if this variable is not set, it uses \*(ME.
The option
.B \-e
lets you select another editor.
.SH "See Also"
.Xr "commands," commands
.Xr "FCEDIT," fcedit
.Xr "ksh" ksh
