Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to test whether a glob has any matches?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
kj  
View profile  
 More options Jul 12 2012, 10:53 am
Newsgroups: comp.unix.shell
From: kj <no.em...@please.post>
Date: Thu, 12 Jul 2012 14:53:59 +0000 (UTC)
Local: Thurs, Jul 12 2012 10:53 am
Subject: [zsh] How to test whether a glob has any matches?

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephane Chazelas  
View profile  
 More options Jul 12 2012, 2:01 pm
Newsgroups: comp.unix.shell
From: Stephane Chazelas <stephane.chaze...@gmail.com>
Date: Thu, 12 Jul 2012 19:01:24 +0100
Local: Thurs, Jul 12 2012 2:01 pm
Subject: Re: [zsh] How to test whether a glob has any matches?
2012-07-12 14:53:59 +0000, kj:

files=(.*~.git)
(($#files)) && git add $files

--
Stephane


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
kj  
View profile  
 More options Jul 17 2012, 9:54 am
Newsgroups: comp.unix.shell
From: kj <no.em...@please.post>
Date: Tue, 17 Jul 2012 13:54:57 +0000 (UTC)
Local: Tues, Jul 17 2012 9:54 am
Subject: Re: [zsh] How to test whether a glob has any matches?
In <20120712180124.GA28...@chaz.gmail.com> Stephane Chazelas <stephane.chaze...@gmail.com> writes:

>files=(.*~.git)
>(($#files)) && git add $files

Nice.  Thanks!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »