Using the fc command

To edit a previous command line use the shell command fc (fix command) command.

   fc -e editor -lnr first last

This will open the commands from the history list as specified in the range first to last. When you exit from the editor the command(s) will be run.

Setting the environment variable FCEDIT to the editor that you prefer will save you specifying it on the command line. For example:

   FCEDIT=emacs; export FCEDIT

[Home] [Search] [Index] This site maintained by unixhelp@mathcs.duq.edu