Working with previously entered commandsThe Korn shell allows you to reuse commands that you previously typed in at the command line. The fc command (fc - fix command) allows you to recall the commands you previously typed in, and then allows you to "fix" them. When you invoke the fc command, it uses the editor that is defined with the FCEDIT environment variable. To list all of the commands you previously typed in, use the list option with fc. This displays all of the commands stored in the history list. The ksh creates an alias for you automatically that enables you to use the command r to repeat your previous commands. "r" is actually an alias of the "fc" command, but is much easier to use when repeating previous commands. Suppose you used "fc -l" to list your previous commands, and decided that you wanted to resubmit command number 21. "r 21" repeats command number 21: Think of the "r" to stand for "repeat".
$ fc -l 20 25 20 ls 21 ls -al | more 22 pwd 23 vi .cshrc 24 cat .profile 25 ps -ef | more $ r 21 ls -al | more (ls -al would now execute)
Next: Working with previously entered Up: Command History and Command Previous: Command History and Command   Contents |