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
>> If yes, if I substitute the usual
>> while read foo bar baz; do
>> with
>> while read foo bar baz || [ -n "$foo" ]; do
>> would that correctly deal with "incomplete lines" for a POSIX
>> compliant shell?
It depends on what you consider correct, surely.
Silently ignore the incomplete line?
Noisily ignore the incomplete line?
Silently act as if the missing newline were there?
Noisily act as if the missing newline were there?
Incomplete line is a fatal error?
Something else?
I've done each (possibly except "something else") on occasion.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index