Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [ -f glob ]
- X-seq: zsh-users 12404
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [ -f glob ]
- Date: Wed, 09 Jan 2008 12:39:48 +0000
- In-reply-to: <20080109091335.49226.qmail@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080109091335.49226.qmail@xxxxxxxxxxx>
Atom Smasher wrote:
> here's a weird one...
>
> this is part of a sanity test on line 369 of my zshrc (link below):
> [ -f /usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ} ]
This is broken: -f expectes exactly one argument and you're giving it an
expression that expands to multiple arguments. The [ ... ] form of
tests isn't recommended anyway, because the arguments aren't parsed
properly so this sort of error will be hidden. But it's not at all
clear what you're trying to do. I think you're looking to see if at
least one of the files in the expansion exists, in which case try
expanding the expression and using a null glob:
files=(/usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ}(N))
if (( ${#files} )); then
# stuff
fi
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author