fc - list or edit and re-execute previously entered commands


fc [-e editor | -l [-n]] [-r] [first [last]]

fc [-e - | -s] [-g] [old=new] [prefix]


This command is a Korn-shell built-in command.

For the first form, first and 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 -l option lists the command on stdout, and -n inhibits the default command numbers. The -r option reverses the order of the list. Without -l, the selected commands are edited by the editor specified with the -e option, or if no -e is specified, the editor specified by the FCEDIT parameter (if this parameter is not set, /bin/ed is used), and then executed by the shell.

The second form re-executes the selected command (the previous command by default) after performing the optional substitution of old with new. If -g is specified, all occurrences of old are replaced with new. This command is usually accessed with the predefined alias r='fc -e -'.