Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
expansion in conditional expression patterns
- X-seq: zsh-users 14486
- From: Sebastian Stark <seb-zsh@xxxxxxxxxxx>
- To: zsh-users ml <zsh-users@xxxxxxxxxx>
- Subject: expansion in conditional expression patterns
- Date: Mon, 12 Oct 2009 19:51:14 +0200
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Consider this expression:
% if [[ 1 != <1-5> ]]; then print outside; fi
% if [[ 1 != <2-5> ]]; then print outside; fi
outside
But what if I want 5 to be a variable?
% limit=5
% if [[ 1 != <2-$limit> ]]; then print outside; fi
zsh: parse error: condition expected: 1
The manual:
Normal shell expansion is performed on the file, string and
pattern
arguments, but the result of each expansion is constrained to be a
sin-
gle word, similar to the effect of double quotes. However,
pattern
metacharacters are active for the pattern arguments; the patterns
are
the same as those used for filename generation, see zshexpn(1),
but
there is no special behaviour of `/' nor initial dots, and no
glob
qualifiers are allowed.
What part of this do I misunderstand?
Thanks for help!
Sebastian
Messages sorted by:
Reverse Date,
Date,
Thread,
Author