On 11/24/16 3:08 AM, Clark Wang wrote:
> See following example:
> 
> [STEP 100] # echo $BASH_VERSION
> 4.4.5(2)-release
> [STEP 101] # read -N 5 v
> abcd<ENTER>
> [STEP 102] # printf '%q\n' "$v"
> $'abcd\n'
> [STEP 103] # read -N 5 v
> <ENTER>
> <ENTER>
> abc[STEP 104] # printf '%q\n' "$v"
> abc
> [STEP 105] #
> 
> The second read did not return the leading "\n"s. According to the manual
> of read -N, "the result is not split on the characters in IFS" but I'm not
> sure how to understand this. Is the behavior correct?

This looks like a bug.  The -N option effectively sets the value of IFS to
"" for the duration of the read command, but it appears that splitting is
still following step 1 of

http://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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to