bug-bash
[Top][All Lists]
Advanced

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

Re: read and inconsistent handling of trailing null field?


From: Chet Ramey
Subject: Re: read and inconsistent handling of trailing null field?
Date: Wed, 29 Jan 2020 10:30:29 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 1/29/20 10:19 AM, Clint Hepner wrote:

> Bash Version: 5.0
> Patch Level: 11
> Release Status: release
> 
> Description:
>         
> read seems to incorrectly drop a null field when performing word-splitting 
> and more fields than variables.
> 
> All the examples below use
> 
>     IFS== read -r n v
> 
> for some input of the form ``name=var...``
> 
> 
> The relative bit of the POSIX spec concerns how to set the variables when 
> there are fewer arguments
> to read than there are fields.

There are exactly two variables and two (split) arguments.

"The shell shall treat each character of the IFS as a delimiter and use the
delimiters as field terminators to split..."

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05


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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]