On Thu, Aug 29, 2013 at 2:54 PM, Greg Wooledge <wool...@eeg.ccf.org> wrote:

> On Thu, Aug 29, 2013 at 12:57:22PM -0400, DJ Mills wrote:
> > On Thu, Aug 29, 2013 at 12:42 PM, DJ Mills <danielmil...@gmail.com>
> wrote:
> >
> > > When using a non-default IFS (a default IFS would trim them), a single
> > > empty trailing field is ignored for read -a.
> > >
> > > IFS=: read -rd '' -a arr < <(printf %s ':foo:bar:'); printf '<%s> '
> > > "${arr[@]}"; echo
> > > <> <foo> <bar>
> > >
> > > I would expect the output to be:
> > > <> <foo> <bar> <>
>
> Looks like:
> http://lists.gnu.org/archive/html/bug-bash/2008-02/msg00056.html
>
> There may be other occurrences.  I seem to recall something more recent
> than 2008.
>

That's a different issue, and in that case makes sense. It's the same
reason that
when reading a file with no trailing newline, read will exit > 0 for the
last line.

In this case, the exit status is irrelevant. In fact, I expect it to exit >
0, as there's no
NUL byte in the input. However, with or without -d, the last field is
completely ignored.

Reply via email to