* Filename Generation - *(.)
@ 2007-10-05 8:03 Atom Smasher
2007-10-05 8:41 ` Stephane Chazelas
0 siblings, 1 reply; 4+ messages in thread
From: Atom Smasher @ 2007-10-05 8:03 UTC (permalink / raw)
To: zsh-users
these do what i'd expect:
ls ./*(.) # list all regular files in the current dir
ls *(.) # list all regular files in the current dir
grep foo ./*(.) # grep 'foo' from regular files in the current dir
this doesn't:
grep foo *(.)
can anyone explain that?
zsh 4.3.4 (amd64-portbld-freebsd6.2)
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
Hofstadter's law:
Any computer project will take twice as long as you think
it will even when you take into account Hofstadter's law.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Filename Generation - *(.)
2007-10-05 8:03 Filename Generation - *(.) Atom Smasher
@ 2007-10-05 8:41 ` Stephane Chazelas
2007-10-05 8:44 ` Atom Smasher
2007-10-05 8:49 ` Stephane Chazelas
0 siblings, 2 replies; 4+ messages in thread
From: Stephane Chazelas @ 2007-10-05 8:41 UTC (permalink / raw)
To: Atom Smasher; +Cc: zsh-users
On Fri, Oct 05, 2007 at 09:03:32PM +1300, Atom Smasher wrote:
> these do what i'd expect:
> ls ./*(.) # list all regular files in the current dir
> ls *(.) # list all regular files in the current dir
> grep foo ./*(.) # grep 'foo' from regular files in the current dir
>
> this doesn't:
> grep foo *(.)
>
> can anyone explain that?
>
> zsh 4.3.4 (amd64-portbld-freebsd6.2)
[...]
In which way does it not work?
Would you have a file whose name starts with "-" in the current
directory and a GNU grep by any chance?
In any case, when passing /unknown/ arguments (practically, if
you can't make sure none of them may start with a - or +), you
need to mark the end of options:
grep foo -- *(.)
--
Stéphane
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Filename Generation - *(.)
2007-10-05 8:41 ` Stephane Chazelas
@ 2007-10-05 8:44 ` Atom Smasher
2007-10-05 8:49 ` Stephane Chazelas
1 sibling, 0 replies; 4+ messages in thread
From: Atom Smasher @ 2007-10-05 8:44 UTC (permalink / raw)
To: zsh-users
On Fri, 5 Oct 2007, Stephane Chazelas wrote:
> Would you have a file whose name starts with "-" in the current
> directory and a GNU grep by any chance?
>
> In any case, when passing /unknown/ arguments (practically, if you can't
> make sure none of them may start with a - or +), you need to mark the
> end of options:
>
> grep foo -- *(.)
================
yep, i had a file named "-" in the directory. thanks.
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"[Patriotism]... is a word which always
commemorates a robbery. There isn't a foot of
land in the world which doesn't represent the
ousting and re-ousting of a long line of
successive 'owners' who each in turn, as
'patriots' with proud swelling hearts
defended it against the next gang of 'robbers'
who came to steal it and did -- and became
swelling-hearted patriots in their turn."
- Mark Twain's Notebook
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Filename Generation - *(.)
2007-10-05 8:41 ` Stephane Chazelas
2007-10-05 8:44 ` Atom Smasher
@ 2007-10-05 8:49 ` Stephane Chazelas
1 sibling, 0 replies; 4+ messages in thread
From: Stephane Chazelas @ 2007-10-05 8:49 UTC (permalink / raw)
To: Atom Smasher, zsh-users
On Fri, Oct 05, 2007 at 09:41:22AM +0100, Stephane Chazelas wrote:
[...]
> In any case, when passing /unknown/ arguments (practically, if
> you can't make sure none of them may start with a - or +), you
> need to mark the end of options:
>
> grep foo -- *(.)
[...]
Oops,
sorry, end of options goes after the options and before the
remaining arguments obviously.
grep -- foo *(.)
standard greps don't recognise options after the first
non-option argument, so
grep foo *(.)
would be OK. But GNU grep (unless called in POSIX mode, as GNU
utilities in general) has the problem.
--
Stéphane
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-05 8:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-05 8:03 Filename Generation - *(.) Atom Smasher
2007-10-05 8:41 ` Stephane Chazelas
2007-10-05 8:44 ` Atom Smasher
2007-10-05 8:49 ` Stephane Chazelas
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).