Is it possible to retrieve the actual commands typed in a bash history? If the command involved (for example) a history substitution or modifier, what is seen in the history is the resulting command rather than the typed command.
A couple of examples. For both of these, suppose that command 123 in the history is
If I type in
!123to use command line 123 from the history, and now look at the latest command in my history I will see
ls Red*rather than
If use the built-in shell command
fc -s Red=Blue 123and look at the history, I will see
ls Blue*rather than
fc -s Red=Blue 123
Similarly, if I use the up-arrow (producing the escape sequence
^[[A) I get the expanded command rather than the actual typed text.
In all of these examples the resulting entry in the history is what I expect but in some cases it would be useful to retrieve the originally typed text. For example, whilst the above examples are quite simple I might be using a complex substitution that I want to edit.
I realise that this would be further complicated after the shell is initialised as a
HISTFILE does not contain this information. I am not concerned with retrieving the original text in this case (although it is interesting).