tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sh read on files missing the final newline



I stumbled over the fact that sh's read returned 1 on the final part 
(call it a line or not) of a file when it didn't end in a newline.

Digging through SUS revealed (in the informative part of read):

	Although the standard input is required to be a text file, and 
	therefore will always end with a <newline> (unless it is an empty file)

as well as other passages that suggested that a "text file" consists of 
"lines" and a "line" is a sequence of non-newline characters plus a newline, 
but I couldn't find a definition explicitly stating that.


Home | Main Index | Thread Index | Old Index