On Thu, Mar 27, 2014 at 5:05 PM, Mike Frysinger wrote:
> thanks, i wasn't aware of that func. that seems like the easiest solution.
mapfile it awesome, but for getting find(1) results into an array you
should continue to use a read -rd '' loop. read -d is somewhat
portable, and mapfile does not
On Thu 27 Mar 2014 19:15:13 Pierre Gaston wrote:
> On Thu, Mar 27, 2014 at 5:53 PM, Mike Frysinger wrote:
> > On Thu 27 Mar 2014 08:01:45 Greg Wooledge wrote:
> > > files=()
> > > while IFS= read -r -d '' file; do
> > >
> > > files+=("$file")
> > >
> > > done < <(find . -iname '*.mp3' ! -iname
I don't believe any shell can currently read nul-delimited input into
an array without looping. It's been suggested to add a delimiter to
mapfile. It looks like mapfile uses zgetline() to wrap around calls to
zread() and doesn't support any delimiter. read(1) on the other hand
uses one of the zread
On Thu, Mar 27, 2014 at 5:53 PM, Mike Frysinger wrote:
> On Thu 27 Mar 2014 08:01:45 Greg Wooledge wrote:
> > files=()
> > while IFS= read -r -d '' file; do
> > files+=("$file")
> > done < <(find . -iname '*.mp3' ! -iname '*abba*' -print0)
>
> i've seen this construct duplicated so many times :
On Thu 27 Mar 2014 08:01:45 Greg Wooledge wrote:
> files=()
> while IFS= read -r -d '' file; do
> files+=("$file")
> done < <(find . -iname '*.mp3' ! -iname '*abba*' -print0)
i've seen this construct duplicated so many times :(. i wish we had a native
option for it. maybe something like: