Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [ -f glob ]
- X-seq: zsh-users 12409
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [ -f glob ]
- Date: Thu, 10 Jan 2008 17:48:41 +1300 (NZDT)
- In-reply-to: <200801091239.m09CdmR9003125@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <20080109091335.49226.qmail@xxxxxxxxxxx> <200801091239.m09CdmR9003125@xxxxxxxxxxxxxx>
On Wed, 9 Jan 2008, Peter Stephenson wrote:
This is broken: -f expectes exactly one argument and you're giving it an
expression that expands to multiple arguments.
================
but, why would it work on bsd and not work on solaris?
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
================
very slightly modified, and working great...
local tz_file
tz_file=(/usr/{share,lib,share/lib}/{zoneinfo,locale/TZ}/${TZ}(.N))
(( ${#tz_file} )) || export TZ=Etc/UTC
thanks!
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"I believe that banking institutions are more dangerous
to our liberties than standing armies."
-- Thomas Jefferson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author