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

Re: Emulating 'locate'

On Oct 4,  3:33pm, Lloyd Zusman wrote:
} Based on this, it seems that zsh and 'find' are both maximally optimized
} with regard to recursive searching ... or at least the're both optimized
} equally well. :)

For certain searches, "find -depth" might actually be faster.  Zsh always
does breadth-first globbing, even when asked to sort the final results

} >     alias xlocate='noglob xlocate'
} Well, using this alias causes the argv indices to be off by one in the
} shell function: $0 becomes 'noglob', argv[1] becomes 'xlocate', etc.

If you're seeing that, then you've accidentally created a function named
"noglob" that has the same body as "xlocate".  Try this:

	alias foo='bar foo'
	foo() { echo $0 }
	functions bar
	functions foo

Note that "foo()" is considered to be "in the command position" and thus
the alias expands and you get

	bar foo () { echo $0 }

which defines two functions, "bar" and "foo" with identical bodies.  I'd
wager that you created the alias, then changed the definition of xlocate,
and ended up with a function named "noglob".

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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