Conversation
`cat()` no longer puts '\n's in weird places (causing double newlines), and no longer improperly strips off a trailing newline.
Contributor
There was a problem hiding this comment.
Why is this there? Wouldn't it actually be incorrect.
Example:
$ printf "foo\n" > foo # printf is like echo, but it properly handles `\n`.
$ printf "bar\n" > bar
$ cat foo bar
foo
bar
$ # There was a newline above this prompt.
With this line, there would be no newline at the end.
Member
Author
There was a problem hiding this comment.
@ariporad I'm not sure what you intend to be the correct behavior. I tried your example, and I see a newline above the prompt.
The line I removed would strip a trailing newline that the old code incorrectly appended. The code doesn't append newlines anymore, so it doesn't need to strip a trailing newline.
Contributor
There was a problem hiding this comment.
@nfischer: Whoops... I apparently can't read... Never mind. (I thought you added this).
Contributor
|
@nfischer: One comment, otherwise looks good! |
Member
Author
|
@ariporad could you clarify your comment? |
Contributor
|
LGTM! |
ariporad
added a commit
that referenced
this pull request
Feb 1, 2016
fix(cat): make behavior more like unix
Member
Author
|
👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cat()no longer puts\n's in weird places (causing double newlines).The behavior of
cat()previously didn't make much sense, since it would stick newlines between files where they don't belong (which unix'scatdoes not actually do).Example: