9

In the settings of the Terminal app, in the advanced tab, there is an option to "Paste newlines as carriage returns" which is enabled by default.

What is this good for?

bmike
  • 235,889
Loax
  • 789

3 Answers3

5

What is it good for?

Sometimes you want to paste exactly what you've copied into something...say a document you're editing in nano or vi and want to preserve it exactly as it is.

Or, you could want to past the CR so it executes the command.

Perhaps the default action to pastes exactly what was copied makes more sense than altering a paste buffer before the application processes the clipboard.

bmike
  • 235,889
Allan
  • 101,432
  • Heads up - I removed the side question from the main question. I tried to make your answer make more sense reflecting the change above. – bmike Dec 22 '18 at 02:44
4

Converts the ASCII \n bytes into \r bytes, or line feeds into carriage returns. This way the system ignores any possible UNIX to MAC line-ending confusion when pasting from the Terminal.

  • 1
    My understanding is that since many yeas ago Unix and MacOS line endings have become identical and thus there is no room for “confusion”. Please correct me if I’m wrong. – Loax Dec 22 '18 at 09:55
  • Terminal has probably d that option since the beginning when most data would be in calssic Mac OS endings - when should the option have been removed – mmmmmm Dec 22 '18 at 11:05
0

This is very useful in some shells (zsh and bash work, but not tcsh for example) so that if you accidentally paste a whole lot of text, it is not immediately executed as a long series of commands. You can edit what is pasted or just abort using Ctrl-C.

I also like it for copying a rectangular subselection of what's on the clipboard by dragging with the option key.