Re: sh read on files missing the final newline

Edgar Fuß <[email protected]> Tue, 7 Jul 2026 15:38:47 +0200
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
> But the sh read built-in doesn't actually require either, though it would
> have done back in SUS days
Are you talking about NetBSD's /bin/sh or what a POSIX shell is required to do?

I also don't understand wat you mean by "back in SUS days".

So, are you saying that a POSIX-compliant shell's read command is required 
to read (and split into the arg vars) a trailing "incomplete line"?

If yes, if I substitute the usual
	while read foo bar baz; do
		...
	done
with
	while read foo bar baz || [ -n "$foo" ]; do
		...
	done
would that correctly deal with "incomplete lines" for a POSIX compliant shell?