This is properly viewed as a bug in bash (and most other shells). Shells can tell terminals to do &quot;bracketed paste&quot;: the start and end of a pasted block is marked with escape sequences. The correct behavior is to use bracketed paste, and to treat newlines inside pastes as multiline text input, not as a ready-to-execute signal.<p>Apparently that hasn&#x27;t happened because of compatibility problems with broken terminals, plus perhaps a bit of work that no one&#x27;s stepped up to do. If anyone wants to tackle this, the GNU readline library would be the place to do it.