You can use the built in fc command list to edit and execute one or more commands from the history file. The general syntax is:
fc [-e editor] [-nlr] [first [last]]
fc -e - [in-line edit] [command reference]
fc Without any arguments, this command returns the most recent command in
the history file, which you can edit, and executes the modified command
when you exit the editor.
To edit commands, fc invokes the editor specified in the FCEDIT variable. If
this variable is not set, /bin/ed is used. To use Qedit/UX instead, enter
export FCEDIT='qedit "-c m@;k,yes;e" '
During an edit operation, the requested lines are put in a temporary file. This file is then passed to Qedit. After editing the lines, you should save your changes before exiting Qedit, at which time the shell will execute the modified commands.
Because the fc command is fairly simple, you can use it by itself. If you
want to assign specific names to each option, you can use aliases. Those
familiar with MPE will recognize the following:
alias listredo="fc -l"
alias redo="fc"
alias xeq="fc -e -" {"do" cannot be used because it is already a valid shell command}
From that point, you can use:
listredo {to list the last 16 commands entered}
redo 100 {to modify and execute command line number 100}
xeq cd {to execute the most recent command starting with cd}
Qedit/UX displays its banner every time you edit a command. Unfortunately,
there is no way to avoid this. You can further customize your Qedit/UX
environment by inserting Set commands in the FCEDIT variable, creating a
local .qeditmgr file or system-wide /usr/robelle/qeditmgr file. You could
then choose one of the three Qedit/UX Modify modes (Robelle, HP or
QZModify), or you can get into full-screen mode directly.
[Francois Desrochers]
....Back to the Qedit Q&A Page