Package: bash
Version: 5.2.21-2

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 &&
> ^C
$ foo &&
> bar blah blah blah
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 &&
> bar blah blah blah
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

-- 
for k in [pow(x,37,0x1a1298d262b49c895d47f) for x in [0x50deb914257022de7fff,
0x213558f2215127d5a2d1, 0x90c99e86d08b91218630, 0x109f3d0cfbf640c0beee7,
0xc83e01379a5fbec5fdd1, 0x19d3d70a8d567e388600e, 0x534e2f6e8a4a33155123]]:
 print("".join([chr(32+3*((k>>x)&1))for x in range(79)])) # <ana...@pobox.com>

Reply via email to