[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IFS and read bug
From: |
Paul Jarc |
Subject: |
Re: IFS and read bug |
Date: |
Mon, 31 Mar 2003 12:06:34 -0500 |
User-agent: |
Gnus/5.090017 (Oort Gnus v0.17) Emacs/21.3 (gnu/linux) |
holzhey@ppprs1.phy.tu-dresden.de wrote:
> IFS="/" read -r -d $'\000' -a uu <<< /kghfjk/jkfzuk/i
>
> now I check, what is in 'uu':
>
> declare -p uu produces:
> declare -a uu='([0]="" [1]="kghfjk" [2]="jkfzuk" [3]="i\
> ")'
>
> The first strange thing is, that field number 3 ends with a
> newline. But maybe tis is what you want and I just don't understand.
I think this is the expected behavior. When you use "<<<", the
command's input is the given string followed by a newline, although
the documentation does not mention the added newline. Then since you
used "-d $'\000'", that newline is not treated as the end of input by
the read command.
> [ "${uu[0]}" = $'\177' ] && echo yes produces:
> yes
>
> This definitely seems to be a bug.
I agree.
paul