This is somehow a follow-up to my last question: Pasting multiple commands into terminal stops at user input
Pasting the following to the terminal works as expected:
(
echo test1
# some comment
echo test2
)
But pressing arrow up to repeat that command gives the following obviously wrong command:
( echo test1 echo test2; )
Pasting the same without the comment and pressing arrow up gives the expected command:
(echo test1; echo test2)
An easy workaround is to add ; before each line with a comment.
But why is this the case ? Is it a bug ?
I use bash. Same behavior in gnome-terminal and tilix.
zshwill work as expected.