3 ms·
Yep (author here), not pasting garbage into a terminal is the main point of this article. Partially, it's a rant against the way-too-trigger-happy "paste clipbo
by tanelpoder 6y ago
Yep (author here), not pasting garbage into a terminal is the main point of this article. Partially, it's a rant against the way-too-trigger-happy "paste clipboard on right mouse click" terminals too.
I decided to finally write this article, after seeing a yet another "mysterious" case of a missing binary in some Oracle database server. Linux/Bash defaults are ok, but historically (coming from traditional Unix background?), people who engineer environments at least in the Oracle database server world, configure their prompts to some "corporate standard". And sometimes they end up suffixing prompts by a nice-looking ">" character, leading to this problem.
I've also seen someone set their root prompt to `root#>`. Since there's no space between the username and #, the "comment start" is not recognized and the redirection clobbering problem is still there.
- tener 6y agoWell, how about making it hard to do accidental input in the first place? If pasting is a problem the maybe make the actions necessary less possible to be triggered randomly?
- adrian_b 6y agoBecause of this problem, good terminals require confirmation before pasting any strings that contain suspicious characters, e.g. carriage returns.
- tinus_hn 6y agoI have seen a ‘good terminal’, apparently. Can you name one?
- andrey_utkin 6y agoXfce4-terminal prompts for confirmation when there's newline in the pasted contents.
- JdeBP 6y agoTwo examples: PuTTY and Windows Terminal both present confirmation dialogue boxes before pasting multiline content.
- bombcar 6y agoiTerm seems to do this also at least with multi line pastes - and then zsh seems to wait for you to hit enter AGAIN before executing anything.
- CGamesPlay 6y agoIn iTerm, Edit -> Paste Special -> Warn Before Multi-Line Paste will disable it if you don't like it. It's probably better to disable it in zsh, but I don't know how to do that. iTerm also provides the "only pop up this warning when I'm at a shell prompt", which is ironically exactly when I don't want it to pop up (since zsh/fish detect it themselves).
- JNRowe 6y agoUsing "unset zle_bracketed_paste" should do what you want, but I've only tried it in rxvt-unicode and the vte-based term I have. It stops zsh reacting to the escape sequences used by multi-line paste, see the docs for a full explanation¹. If you were to use I'd recommend sticking it behind a "if $TERM" guard so that it you don't end up surprised if you switch to a term that doesn't warn at some point ;) ¹ http://zsh.sourceforge.net/Doc/Release/Parameters.html#index-bracketed-paste http://zsh.sourceforge.net/Doc/Release/Parameters.html#index...
- GoblinSlayer 6y agoPuTTY accepts multiline pastes for me just fine, I use it with nano.
- klyrs 6y agoI was musing over IPython's behavior right before reading your comment... it's not a terminal, per se, but if you paste in multiple lines, the input switches into a multiline mode. This suggests that bash could handle it in the same manner without relying on a terminal application. In my experience, the advice "don't paste garbage into your terminal" is about as useful as "don't make mistakes." Sometimes it happens when I forget to hit shift on copying from a terminal, or accidentally holding it while copying from another window. Humans make mistakes. I like seatbelts even though they've never saved my life.