[zsh] How to test whether a glob has any matches?
- From: kj <no.email@xxxxxxxxxxx>
- Date: Thu, 12 Jul 2012 14:53:59 +0000 (UTC)
I would like to do something, in essence, like this (zsh globs):
[[ -n .*~.git ]] && git add .*~.git
In words, the *intent* of the above is something like "if there
are in the current directory any dot-items (other than .git), then
add them to the git index."
Of course, the test above is basically nonsense; it certainly does
not do what is intended.
I thought that zsh offered a mechanism for performing this sort of
test, but I can't find it. Is my memory tricking me?
Thanks!
PS: One way to achieve the desired result would be something like
[[ -n $(echo .*~.git) ]] && git add .*~.git
.
- Follow-Ups:
- Re: [zsh] How to test whether a glob has any matches?
- From: Stephane Chazelas
- Re: [zsh] How to test whether a glob has any matches?
- Prev by Date: Re: grep recursive
- Next by Date: Re: [zsh] How to test whether a glob has any matches?
- Previous by thread: grep recursive
- Next by thread: Re: [zsh] How to test whether a glob has any matches?
- Index(es):