Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Expansion, matching, files
- X-seq: zsh-users 14558
- From: "Jerry Rocteur" <macosx@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Expansion, matching, files
- Date: Thu, 12 Nov 2009 11:41:49 +0100 (CET)
- Importance: Normal
- 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
Hi,
I'm playing with something that is bugging me...
I want to find if a file exists either ff.log or ll.log for example
Now to do this with pattern maching is easy:
I create my file for example
touch ff.log
ll *log
-rw-r--r-- 1 jro softdev 0 Nov 12 10:40 ff.log
for f in *
do
[[ $f == (ff|ll).log ]] && echo Yes
done
Yes
This also works of course:
print (ff|ll).log
ff.log
But I would like to do this:
[[ -e (cc|ff).log ]] && echo yes
zsh: parse error near `('
Can I use this kind of pattern in an if statement ?
NOTE: I know I could do [[ -e ff.log || -e ll.log ]] && echo yes
But that would not be fun nor simple to type if for example you wanted to test ([a-z][5-6]).log
Thanks in advance,
Jerry
Messages sorted by:
Reverse Date,
Date,
Thread,
Author