On Wed, Mar 24, 2010 at 04:10:41PM +0200, Pierre Gaston wrote: > On Wed, Mar 24, 2010 at 12:43 AM, Rob Robason <r...@robason.net> wrote: > > $ ls -a | readarray # using the default MAPFILE array > It's a faq, commands in a pipe are executed in a subshell and don't modify > the parent shell.
And the workaround for this is to use process substitution: readarray < <(your command) (Don't use ls -a for this. Horrible example. If you want to stuff an array with files, just use array=(*) instead, possibly turning on dotglob and/or nullglob first.)