Posted by: Administrator
on July 19, 2005 10:08 PM
Bash provides two builtin commands which manipulate the history list and history file: history and fc. As demonstrated in this article, history is great for recalling complete or sections of previous commands. If you must edit a command from your history before execution--fox example, to fix a typo in a long command line--consider using fc.
For example: % history<nobr> <wbr></nobr>... 496 vi text_file.txt 497 vi another_file.txt
The following lines open an editor (If ename is not given, the value of the following variable expansion is used: ${FCEDIT:-${EDITOR:-vi}}) and display the text "text_file.txt". % fc 496 % fc text
When editing is complete, the edited commands are echoed and executed.
Editing Command History
Posted by: Administrator on July 19, 2005 10:08 PMFor example:
% history<nobr> <wbr></nobr>...
496 vi text_file.txt
497 vi another_file.txt
The following lines open an editor (If ename is not given, the value of the following variable expansion is used: ${FCEDIT:-${EDITOR:-vi}}) and display the text "text_file.txt".
% fc 496
% fc text
When editing is complete, the edited commands are echoed and executed.
#