* ls g^h
@ 2009-01-22 19:12 zzapper
2009-01-22 20:00 ` Henno Brandsma
0 siblings, 1 reply; 6+ messages in thread
From: zzapper @ 2009-01-22 19:12 UTC (permalink / raw)
To: zsh-users
Hi
When I mistyped a
^g^h type substitute
with
g^h
I was surprised to find that it matched
a directory "growth"
eg
ls g^h would list the directory
what functionality/fng is that? (hope it's not me being dumb)
--
zzapper
http://www.successtheory.com/tips/vimtips.html
http://www.successtheory.com/tips/zshtips.html
http://www.successtheory.com/tips/cygwintips.php (in progress)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ls g^h
2009-01-22 19:12 ls g^h zzapper
@ 2009-01-22 20:00 ` Henno Brandsma
2009-01-23 19:13 ` zzapper
0 siblings, 1 reply; 6+ messages in thread
From: Henno Brandsma @ 2009-01-22 20:00 UTC (permalink / raw)
To: zzapper; +Cc: zsh-users
Op 22 jan 2009, om 20:12 heeft zzapper het volgende geschreven:
> Hi
> When I mistyped a
> ^g^h type substitute
> with
> g^h
>
> I was surprised to find that it matched
> a directory "growth"
> eg
> ls g^h would list the directory
>
> what functionality/fng is that? (hope it's not me being dumb)
>
>
In zshguide.pdf (around page 227) there is some discussion on
EXTENDED_GLOB: it's part of that.
g^h is the pattern "everything starting with g but not matching "h"
exactly ". You happened to have exactly
one file starting in 'g', I suppose (the final h seemingly matching
is coincidental).
E.g. if I have 2 files "good" and "growth" then g^h matches them both,
with EXTENDED_GLOB set.
In short: it becomes a globbing pattern by virtue of the presence of ^
Regards
Henno Brandsma
>
>
> --
> zzapper
> http://www.successtheory.com/tips/vimtips.html
> http://www.successtheory.com/tips/zshtips.html
> http://www.successtheory.com/tips/cygwintips.php (in progress)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ls g^h
2009-01-22 20:00 ` Henno Brandsma
@ 2009-01-23 19:13 ` zzapper
2009-01-24 17:45 ` Mikael Magnusson
0 siblings, 1 reply; 6+ messages in thread
From: zzapper @ 2009-01-23 19:13 UTC (permalink / raw)
To: zsh-users
Henno Brandsma wrote in news:900AB2BB-03D0-494A-99FF-D364BD0C31A4@hetnet.nl:
>
Thanks Henno
trying to work out where this would be useful
ls -1 *.^txt # list all but *.txt
any more?
--
zzapper
http://www.successtheory.com/tips/vimtips.html
http://www.successtheory.com/tips/zshtips.html
http://www.successtheory.com/tips/cygwintips.php (in progress)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ls g^h
2009-01-23 19:13 ` zzapper
@ 2009-01-24 17:45 ` Mikael Magnusson
2009-01-26 12:39 ` zzapper
0 siblings, 1 reply; 6+ messages in thread
From: Mikael Magnusson @ 2009-01-24 17:45 UTC (permalink / raw)
To: zsh-users
2009/1/23 zzapper <david@tvis.co.uk>:
> Henno Brandsma wrote in news:900AB2BB-03D0-494A-99FF-D364BD0C31A4@hetnet.nl:
>
>>
> Thanks Henno
>
> trying to work out where this would be useful
>
> ls -1 *.^txt # list all but *.txt
>
> any more?
% rm -rf Pictures_of_^beautiful_flowers
removed directory: `Pictures_of_old_garbage'
removed directory: `Pictures_of_random_junk'
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ls g^h
2009-01-24 17:45 ` Mikael Magnusson
@ 2009-01-26 12:39 ` zzapper
2009-01-26 12:45 ` Mikael Magnusson
0 siblings, 1 reply; 6+ messages in thread
From: zzapper @ 2009-01-26 12:39 UTC (permalink / raw)
To: zsh-users
Mikael Magnusson wrote in
news:237967ef0901240945y4c908dccn4c1c1deb2c9f0a2c@mail.gmail.com:
> 2009/1/23 zzapper <david@tvis.co.uk>:
>> Henno Brandsma wrote in
>> news:900AB2BB-03D0-494A-99FF-D364BD0C31A4@hetnet.nl:
>>
>>>
>> Thanks Henno
>>
>> trying to work out where this would be useful
>>
>> ls -1 *.^txt # list all but *.txt
>>
>> any more?
>
> % rm -rf Pictures_of_^beautiful_flowers
> removed directory: `Pictures_of_old_garbage'
> removed directory: `Pictures_of_random_junk'
>
The conventional zsh way would be?
ls *.*~*.txt
rm -rf Pictures_of_*~*beautiful_flowers
--
zzapper
http://www.successtheory.com/tips/cygwintips.php (in progress)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ls g^h
2009-01-26 12:39 ` zzapper
@ 2009-01-26 12:45 ` Mikael Magnusson
0 siblings, 0 replies; 6+ messages in thread
From: Mikael Magnusson @ 2009-01-26 12:45 UTC (permalink / raw)
To: zsh-users
2009/1/26 zzapper <david@tvis.co.uk>:
> Mikael Magnusson wrote in
> news:237967ef0901240945y4c908dccn4c1c1deb2c9f0a2c@mail.gmail.com:
>
>> 2009/1/23 zzapper <david@tvis.co.uk>:
>>> Henno Brandsma wrote in
>>> news:900AB2BB-03D0-494A-99FF-D364BD0C31A4@hetnet.nl:
>>>
>>>>
>>> Thanks Henno
>>>
>>> trying to work out where this would be useful
>>>
>>> ls -1 *.^txt # list all but *.txt
>>>
>>> any more?
>>
>> % rm -rf Pictures_of_^beautiful_flowers
>> removed directory: `Pictures_of_old_garbage'
>> removed directory: `Pictures_of_random_junk'
>>
> The conventional zsh way would be?
> ls *.*~*.txt
> rm -rf Pictures_of_*~*beautiful_flowers
There is a small difference between ^ and ~ in this context. ~ matches
the whole globbed string while ^ only matches a single element, IIRC
at least. So you can do a/^foo/blue which is not the same as
a/*/blue~foo/blue but rather a/(*~foo)/blue, again IIRC.
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-01-26 12:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-22 19:12 ls g^h zzapper
2009-01-22 20:00 ` Henno Brandsma
2009-01-23 19:13 ` zzapper
2009-01-24 17:45 ` Mikael Magnusson
2009-01-26 12:39 ` zzapper
2009-01-26 12:45 ` Mikael Magnusson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).