Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[[ -f file* ]]
- X-seq: zsh-users 14132
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: [[ -f file* ]]
- Date: Mon, 18 May 2009 21:14:48 +1200 (NZST)
- 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
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.
so far this seems like the best way to do it:
{ ls test* } 2> /dev/null | read -k 2 -u 0
if one or more files match the pattern "test*", read returns 0. if no
files match the pattern, read returns >0.
is there a better way?
thanks...
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"Wars not make one great." -- Yoda
Messages sorted by:
Reverse Date,
Date,
Thread,
Author