Activity for Lover of Structureâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #288915 |
That would already be very much welcomed (but of course the more the better). (more) |
— | over 1 year ago |
Comment | Post #288915 |
Well, actually, I think we two are on the same page in that we'd be happier if Unix/Linux text files were defined more permissively, but then it's hard (and pointless) to argue with an established POSIX definition. (Also I am trying very strongly to avoid the kind of heated discussion that took place... (more) |
— | over 1 year ago |
Comment | Post #288915 |
Actually, I don't think the rule is dumb, it's more like that Unix aficionados feel strongly that text files "must" end in newlines. To a layman it's more like, "I heard that you mustn't forget a newline at the end of a text file, because some commands will misprocess data with a missing final newlin... (more) |
— | over 1 year ago |
Comment | Post #288915 |
Well, some commenters argued that the original short version of my question was unanswerable because you'd have to check every implementation of every Unix/Linux command, because, after all, implementations are free to do whatever they want with malformed input. So I basically added justification for... (more) |
— | over 1 year ago |
Comment | Post #288915 |
My question is verbose because it was first asked on *Stack Exchange: Unix & Linux*, where it was closed. (more) |
— | over 1 year ago |
Edit | Post #288915 | Initial revision | — | over 1 year ago |
Question | — |
What unexpected things can happen if a user runs commands expecting a text file on input lacking a file-final newline? It is often taught that in Unix/Linux text files should end with newline characters. The reason given (orally) to me by various sources was that "some commands (such as `wc`) assume or require a newline at the end of a text file". (Other commands I am aware of are: `sed`, `read`, `cron`/`crontab`, an... (more) |
— | over 1 year ago |