Re: Empty trailing fields ignored by read

2013-09-02 Thread Chet Ramey
On 8/29/13 12:42 PM, DJ Mills 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 > <> > > I would expect the output to be: > <>

Re: Empty trailing fields ignored by read

2013-08-29 Thread DJ Mills
On Thu, Aug 29, 2013 at 2:54 PM, Greg Wooledge 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 > wrote: > > > > > When using a non-default IFS (a default IFS would trim them), a single > > > empty trailing field is ignored for rea

Re: Empty trailing fields ignored by read

2013-08-29 Thread Greg Wooledge
On Thu, Aug 29, 2013 at 12:57:22PM -0400, DJ Mills wrote: > On Thu, Aug 29, 2013 at 12:42 PM, DJ Mills 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:');

Re: Empty trailing fields ignored by read

2013-08-29 Thread DJ Mills
On Thu, Aug 29, 2013 at 12:42 PM, DJ Mills 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 > <> > > I would expect the outpu

Empty trailing fields ignored by read

2013-08-29 Thread DJ Mills
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 <> I would expect the output to be: <> <>