[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: replacement for the nullglob bashism

On Thu, Apr 15, 2004 at 08:50:28AM +0200, Thomas Viehmann wrote:
> I'm looking for a substitute for (unposixly) doing "shopt -s nullglob"
> before a loop over an expansion.
> Is there a good substitution?
> The shortest I came up with was doing
> [ "$(echo *.foo)" = "*.foo" ] || for X in *.foo ; do foo "${X}"; done

There might actually be a file called "*.foo" :-)

I'd probably give up and use find/xargs instead myself.

Colin Watson                                  [cjwatson@flatline.org.uk]

Reply to: