Jon Reinhold's answer is great, but there's is a much more powerful
solution that I'll suggest. I also have a comment about a gotcha in
Jon's answer, but I don't have enough reputation to be able to comment
directly, so @Jon Reinhold, if you read this, please address my
comment to you below.
Bash includes a command fc
, which takes as parameters line numbers
of the bash history list. It then opens your default editor with those
lines as text. At that point, you can optionally edit the lines. Then,
when you exit the editor, bash executes those lines!
An example of an edit you might want to make is append to all but the
last line something like "; read -p"next ...". That will cause bash to
execute each line, and prompt you before continuing.
Comment for Jon Reinhold: Great answer, but you should qualify it
because if the user has set bash variable HISTCONTROL to include
erasedups
, then after performing C-o
the user will be confused
because instead of the expected next command in the history being
displayed, the one after that will be displayed. This is because bash
has deleted the original instance of the executed command, and thus
all the commands afterwards have shifted up one line, ie. to one lower
index number in the history list.