Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: glob expansion
- X-seq: zsh-users 12810
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: glob expansion
- Date: Mon, 28 Apr 2008 04:50:01 -0400
- Cancel-lock: sha1:nXENfPec1nxq7cIHYNuWl3g+S84=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <F5AD0ED4-956A-4C38-A975-1B862ACBC4C5@xxxxxxxxx> <878wyy4cnv.fsf@xxxxxxxxxx> <87ve222xna.fsf@xxxxxxxxxx> <30CABFA5-A087-4C4E-8DCA-221FBB01C0B3@xxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Michael Wild <themiwi@xxxxxxxxx> writes:
> On 28Apr, 2008, at 10:26, Lloyd Zusman wrote:
>
>> Lloyd Zusman <ljz@xxxxxxxxxx> writes:
>>
>>> Michael Wild <themiwi@xxxxxxxxx> writes:
>>>
>>>> [ ... ]
>>>>
>>>> find /usr/lib -type f -name *.so
>>>>
>>>> [ ... ]
>>>>
>>>> So my question: Is there any way to change the expansion behavior of
>>>> ZSH? The man-pages and the FAQ didn't help me, nor did google. But
>>>> then, I'm quite sure I didn't use the appropriate search terms...
>>>
>>> Try this:
>>>
>>> alias find='noglob /usr/bin/find'
>>>
>>> Then, issue the command above. This works for specific commands.
>>> Also,
>>> look at 'setopt nonomatch' if you want this behavior all the time.
>>
>> Of course, the 'nonomatch' option doesn't work quite the same way as
>> the
>> 'noglob' prefix. It only suppresses the error and returns the
>> wildcard
>> if the glob doesn't match -- it expands it if it does. The 'noglob'
>> prefix ensures that no glob expansion will be performed in any case.
>>
>> I shouldn't post here before my morning coffee.
>
> ;-) I sure got the difference, and nonoglob exactly does what I want.
> Expansion if possible, otherwise pass it on without erroring out.
Well, I'm glad that I accidentally described what you're looking
for. :)
Just keep in mind that nonomatch won't do what you seem to want in your
'find' example. Suppose the current working directory contains the
following files:
aaa bbb ccc.so ddd.so eee.so subdir
... where 'subdir' is the top of a directory tree containing many other
*.so files.
If you have 'setopt nonomatch' and you issue the following command ...
find . -type f -name *.so
... that command will be expanded like this before it is executed:
find . -type f -name ccc.so ddd.so eee.so
It will then not give you what you're looking for.
--
Lloyd Zusman
ljz@xxxxxxxxxx
God bless you.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author