In Bash (as well as Bash in WSL), multiline written commands can call-back with up/down arrows correctly also built-in history
command report them correctly (until I'm still logged-in in bash).
But after exiting from bash
and press up/down arrows, multiline commands appears each as separate entries and that's because cat ~/.bash_history
has chucked the command on multiple separate entries and writing problem here; the history
command result messed too.
I have set these options in ~/.bashrc
shopt -s cmdhist lithist
HISTTIMEFORMAT='%F %T '
and now writing problem fixed but history
command still report in multiple line and separate entries (reading problem now).
Bash version is 4.3, same issue on v4.4
there is this bug report since a long years but no solution yet.
Update:
it's also to mention that below multiline command as an example is correctly displaying even after exit Bash:
for i in {1..10}
do
echo $i
done
but this is failing:
awk '
{ print $1}' <<<'first last'
Update 2:
the issue mentioned above is fixed in Bash v5.0.0+ that changed to recognize entries between "timestamp as delimiter" as single entry of command (HISTTIMEFORMAT, cmdhist and lithist must be set).