Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Emulating 'locate'
- X-seq: zsh-users 6631
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Emulating 'locate'
- Date: Fri, 03 Oct 2003 12:22:13 -0400
- In-reply-to: <20031002080358.GA23230@DervishD> (raul@xxxxxxxxxxxx's message of "Thu, 2 Oct 2003 10:03:58 +0200")
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20031001221753.GA23189@DervishD> <1031002023639.ZM22046@xxxxxxxxxxxxxxxxxxxxxxx> <20031002080358.GA23230@DervishD>
- Reply-to: ljz@xxxxxxxxxx
- Sender: Lloyd Zusman <ljz@xxxxxxxxxx>
DervishD <raul@xxxxxxxxxxxx> writes:
> Hi Bart :)
>
> * Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> dixit:
>> [We should just go off and have our own little mailing list.]
>
> Well... As I said a few weeks ago, I'm on the way of learning Zsh
> and sometimes I practice what is said in the manual doing things like
> these. Sometimes I have success, others I don't. I know, I make many
> questions, and maybe you are the only able to answer then, so don't
> feel guilty if you want to ignore most of them ;)))
>
> [ ... ]
>
>
>> locate() { print -l /**/*${^*}*{,/**/*} }
>
> Ok, it works like a charm... Thanks a lot, as always :)
I might have missed something about this in the first part of the thread
a couple weeks ago (those messages have already expired on my system),
but in case it wasn't mentioned before, I want to point out that this
function is _extremely_ slow in comparison to the standard 'locate'
command. It traverses through every accessible item on every accessible
file system in order to check for a match. On my server, it's literally
thousands of times slower than using the standard 'locate'.
I'm not sure how it compares to this:
locate() { find / -name "*${^*}*" -print }
... but it's certainly has more or less the same order of magnitude
of slowness.
Figuring this out is a very good learning experience for zsh. However,
I would not recommend installing this function for everyday use on a
reasonably sized system.
> [ ... ]
--
Lloyd Zusman
ljz@xxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author