Over many years I used ksh
. I like the possibility to use Esc v in command history to call the editor "vi". If this command in the history was spread over many lines – for example because of a while loop – "vi" shows this history also over many lines. With this feature it is easy possible to write complex statements without writing the input to a file.
Years ago I changes to bash
. It has the same possibility with default shortcut Ctrl–X Ctrl–E. The slightly difference is that bash
is merging all lines to one long line delimited with a semicolon. Syntax is still correct but we lose readability.
So what I am doing, I am calling ksh, if I see the commands become complex.
Is there a way to configure bash
in a way not to merge the lines of the history and act as ksh
is doing it?
Any help is welcome.
Best Answer
Use:
I suspect the reason this isn't enabled by default is because people often use commands like
history | grep something
to find history entry numbers. If a history entry is split across multiple lines, the line that matchesgrep
won't always contain the entry number.