Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ -f file* ]]
- X-seq: zsh-users 14137
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [[ -f file* ]]
- Date: Mon, 18 May 2009 13:40:40 +0200
- In-reply-to: <17393e3e0905180236v424b14d5ua9d364501662c75a@xxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20090518091455.83279.qmail@xxxxxxxxxxx> <17393e3e0905180236v424b14d5ua9d364501662c75a@xxxxxxxxxxxxxx>
Matt Wozniski <godlygeek@xxxxxxxxx>:
> On Mon, May 18, 2009 at 5:14 AM, Atom Smasher wrote:
> > if i want to test for the presence of one or more files matching a certain
> > pattern, it seems non-trivial to do it with the normal "test" or conditional
> > expressions.
> ...
> > is there a better way?
>
> Well, off the top of my head, I can think of
>
> [ -n "$(print -- test*(N))" ]
>
> but even that seems inelegant; I'm sure someone can chime in with
> something better.
How about this:
[snip]
set -- test*(N)
(( $# > 0 ))
[snap]
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author