Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Globbing inside conditional expression
- X-seq: zsh-users 14891
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Globbing inside conditional expression
- Date: Fri, 26 Feb 2010 10:54:50 +0000
- In-reply-to: <5169ff11002260218ld3499cco24f8285706ee946c@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: CSR
- References: <5169ff11002260218ld3499cco24f8285706ee946c@xxxxxxxxxxxxxx>
On Fri, 26 Feb 2010 10:18:01 +0000
Ben North <ben@xxxxxxxxxxxxxxxx> wrote:
> > Actually [[ -f XX* ]] is invalid because [[ ]] doesn't do globbing.
> > You need the [ -f XX* ] form (see below).
>
> answering my question. Apologies for the noise.
>
> Perhaps the documentation could be clarified though?
It's sort of implied by the fact that patterns are used for other reasons
in conditions, though as the XX* in the -f isn't a pattern there's room for
ambiguity in interpreting the documentation as it stands.
I suppose it's obvious, but globbing would produce multiple files, and then
a lot of the tests don't really make sense. What does [[ -d XX* ]] mean if
some expansions are directories and some aren't?
Index: Doc/Zsh/cond.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/cond.yo,v
retrieving revision 1.8
diff -p -u -r1.8 cond.yo
--- Doc/Zsh/cond.yo 19 Jan 2010 10:20:16 -0000 1.8
+++ Doc/Zsh/cond.yo 26 Feb 2010 10:52:01 -0000
@@ -183,9 +183,10 @@ enditem()
Normal shell expansion is performed on the var(file), var(string) and
var(pattern) arguments, but the result of each expansion is constrained to
-be a single word, similar to the effect of double quotes. However, pattern
-metacharacters are active for the var(pattern) arguments; the patterns
-are the same as those used for filename generation, see
+be a single word, similar to the effect of double quotes.
+File generation is not performed on any form of argument to conditions.
+However, pattern metacharacters are active for the var(pattern) arguments;
+the patterns are the same as those used for filename generation, see
ifzman(\
zmanref(zshexpn)\
)\
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author