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

Re: Emulating 'locate'



On Oct 2, 10:03am, DervishD wrote:
}
} > For that you have to use brace expansion, because you can't mix **/ and
} > any other form of alternation:
} 
}     Didn't know about the mixing...

To be precise, you can't express "this file pattern OR this hierarchy"
with (pat1|pat2) syntax.  The alternate patterns can't contain slashes.
That leaves using brace expansion to express "this file pattern" and
"this hierarchy" as separate patterns.

Which reminds me ... instead of this:

} >     locate() { print -l /**/*${^*}*{,/**/*} }

You might want:

    locate() {
	setopt localoptions nullglob nocshnullglob
	print -l /**/*${^*}*{,/**/*}
    }

Do you see why?



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