On 11/23/11 6:54 PM, Matthew Story wrote:
> On Nov 23, 2011, at 4:47 PM, Chet Ramey wrote:
> 
>> On 11/23/11 9:03 AM, Matthew Story wrote:
>>> Bash Version: GNU bash, version 4.1.7(1)-release (amd64-portbld-freebsd8.0)
>>>          OS: FreeBSD 8.0
>>>    Hardware: amd64
>>> Environment: jail
>>> Description: read terminates reading all records at first null-byte ( 
>>> chr(0) ) in a stream, null-bytes are valid ascii characters and should not 
>>> cause read to stop reading
>>>              a line this behavior is not reproducible using bourne shell.
>>
>> Bash doesn't stop reading at the NUL; it reads it and the rest of the line
>> up to a newline.  Since bash treats the line read as a C string, the NUL
>> terminates the value assigned to `foo'.  
> 
> it seems to terminate all assignment of the current line at the first `\0', 
> not merely the value assigned to `foo':

Yes, sorry.  That's what the "bash treats the line read as a C string"
was intended to imply.  Since the line read is a C string, the NUL
terminates it and what remains is assigned to the named variables.  I
should have used `line' in my explanation instead of `foo'.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to