Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Globbing inside conditional expression
- X-seq: zsh-users 14889
- From: Ben North <ben@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Globbing inside conditional expression
- Date: Fri, 26 Feb 2010 10:03:18 +0000
- 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,
Just come across this behaviour of globbing inside a conditional
expressions:
% mkdir test
% cd test
% echo hello > foo.1
% echo foo.*
foo.1
% [[ -s foo.1 ]] && echo yes || echo no
yes
% [[ -s $(echo foo.*) ]] && echo yes || echo no
yes
#### The following one does not do what I was expecting:
% [[ -s foo.* ]] && echo yes || echo no
no
% echo $ZSH_VERSION
4.2.6
% man zshall
[...]
CONDITIONAL EXPRESSIONS
[...]
-s file
true if file exists and has size greater than zero.
[...]
Normal shell expansion is performed on the file, string and
pattern arguments, but the result of each expansion is
constrained to be a single word, similar to the effect of
double quotes. [...]
(I tried with 4.2.7 and got the same results.)
I was expecting 'normal shell expansion' to include globbing, but am I
misunderstanding this?
Thanks for any suggestions,
Ben.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author