Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: check for existence without full globbing



On Feb 4,  3:38am, John Buttery wrote:
} 
}   Just out of curiosity, isn't this a problem that's neatly solved with
} a utility like find(1)?

In this particular instance, I don't know of any way to get find to
descend all directories while reporting the name of each directory that
contains a plain file matching a certain pattern.  I'd be happy to be
proved wrong ... but my zsh solution isn't doing that either.

However, in the general case the best answer is: Unless efficiency is an
overriding concern, use whatever utility you're more familiar with.

To use any external utility like `find', you have to fork it and read
its output. That's quite a bit of overhead. If you're going to pipe
the output off to some other external program, or use the result as
arguments to another program, then `find' is fine. If you want to suck
the output back into zsh to do string manipulations, it's probably more
efficient to use a glob in an array assignment.



Messages sorted by: Reverse Date, Date, Thread, Author