Search code examples
bashcopy-paste

Why sometimes when I paste a command on my bash prompt it gets executed even if I don't press Enter?


The command get executed without the need of pressing Enter. This can be dangerous sometimes...

Why is that and how can I prevent it?


Solution

  • Because you paste new line character with it. It's sometimes can be useful, for example, you can copy/paste many commands (long multi-line scripts) at once.

    Well, It has never occurred to me to prevent this particular behavior. It's normal and expected. WYPIWYG - what you paste is what you get.