Open System Services Shell and Utilities Reference Manual (G06.29+, H06.08+, J06.03+)
fc(1) OSS Shell and Utilities Reference Manual
NAME
fc - Lists, edits, or reexecutes commands
SYNOPSIS
fc [-r][-e editor][first [last]]
fc -l[-nr] [first [last ]]
fc -s[old=new][first]
fc -e -[old=new][first] (Obsolescent)
FLAGS
-e editor Uses the specified editor to edit the commands. The value in the FCEDIT variable is
used as a default when -e is not specified. If FCEDIT is null or unset, ed is used as the
editor.
-l Lists the commands rather than invokes an editor on them. The commands are written in
the sequence indicated by the first and last arguments, as affected by -r, with each com-
mand preceded by the command number.
-n Suppresses command numbers when listing with -l.
-r Reverses the order of the commands listed with -l or editor (with neither
-l or -s). An obsolescent version of -r is fc -e -.
-s Reexecutes the command without invoking an editor.
DESCRIPTION
The fc command lists or edits and reexecutes commands previously entered to an interactive shell.
The parameters first and last specify a range of commands to be listed or edited, where first and
last are the names of previously executed commands or the numbers of commands in the list pro-
duced by the history command. A negative number is used as an offset to the current command
number.
If last is not specified, then it will be set to first.Iffirst is not specified, the previous command is
the default for editing. The old=new argument replaces the first occurrence of a command name
old in the commands to be reexecuted by the string new.
The number of previous commands that can be accessed is determined by the value of the HIST-
SIZE variable.
EXAMPLES
1. The following command reexecutes the command whose number in the history log
corresponds to the number given for the argument.
fc -s argument
2. The following command opens the vi editor on the command in the history log that
corresponds to the number given for the argument.
fc -e vi argument
NOTES
The fc command is a shell built-in command. It differs from the regular commands in that it does
not open a new shell process when it executes.
A general discussion of shell built-in commands and a list of the OSS shell built-in commands are
in the reference page for sh(1).
RELATED INFORMATION
3−128 Hewlett-Packard Company 527188-021