i used to enable lithist option, which make bash history store in multiline, but one day, the lithist option not work.
enabling lithist mean you can store multiline in one history entry. if you type some command enclosed by bracket:
~:$ ( > echo hey > echo bye > ) hey bye
ctrl-p , you will see this:
~:$ ( echo hey echo bye )
in my bad day that lithist broken, one will see multiline splitted into multiple entry
# press ctrl-p ~:$ ) # press ctrl-p again ~:$ echo bye
this problem occur a few times before. it is usually happend because the size of
~/.bash_history exceed the variable
HISTFILESIZE , and bash truncate the
~/.bash_history, which make format of history file broken.
i used to remove some beginning line of history file, then restart the shell,
and history would recovery.
however, this time it does not recover even after i remove the whole history file.
HISTSIZE=1000 HISTFILESIZE=8000 shopt -s cmdhist lithist
with lithist working, the output of command
should look like to following:
4519* 2019-08-24 15:46:05 ( echo hey echo bye ) 4520 2019-08-24 16:00:21 history 4521 2019-08-24 16:00:23 history | less
the output of history broken when lithist broken, too:
1 2019-08-24 14:25:04 \rm .bash_history 2 2019-08-24 14:25:13 ( 3 2019-08-24 14:42:26 echo a 4 2019-08-24 14:42:26 echo c 5 2019-08-24 14:42:26 )
however, my history file looked ok:
#1566627904 \rm .bash_history #1566627913 ( echo a echo c ) #1566627926 echo bye
this behavior appear on CentOS 6.10 , and can not be fix, but can be fix on another machine with debian stretch.