If you set HISTCONTROL=ignoredups, then typing two successive identical
shell commands generates only one entry in your shell history. But this
is mishandled in the following edge case:
1. enter an incomplete command, such as one ending in &&. The shell
prompts via $PS2 for you to finish it. Press ^C to not do so. The
partial command is stored in history.
2. enter the same incomplete command again, and this time, do something
at the $PS2 prompt that completes it. The compound command runs, but is
not stored in history, apparently on the grounds that its _first_ line
matched the previous history entry and had already triggered the
'ignoredups' behaviour.
Sample transcript, in a shell running in a completely clean VM:
$ HISTCONTROL=ignoredups
$
$ foo() { echo "Test command foo"; }
$ bar() { echo "Test command bar"; }
$
$ foo &&
$ foo &&
Test command foo
Test command bar
Here I entered 'foo &&', then changed my mind and hit ^C. Then I entered
it again, this time followed by a second 'bar' command. The output shows
that the commands ran.
But now if I press the up arrow to recall the previous command, it's
just 'foo &&'. The bar command has been completely lost. Whereas if I'd
done this _without_ the previous commands ...
$ foo &&
Test command foo
Test command bar
then pressing the up arrow would recall the command 'foo && bar blah
blah blah' all on one line.
Cheers,
Simon