tech-userlevel archive

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

Re: sh read on files missing the final newline



> 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?


Home | Main Index | Thread Index | Old Index