Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
for loop question
- X-seq: zsh-users 19310
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: for loop question
- Date: Sun, 02 Nov 2014 12:47:06 -0800
- 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
test()
{
# THIS WORKS FINE:
i=1
while [ -n "$TLC[i]" ]; do
let i=i+1
print -ru2 $TLC[i]
done
# THIS WORKS FINE:
for ((i=1; i<6; i++))
do
print -ru2 $TLC[i]
done
# ... BUT THIS FAILS WITH "BAD OUTPUT FORMAT SPECIFICATION":
for ((i=1; [ -n "$TLC[i]" ]; i++))
do
print -ru2 $TLC[i]
done
}
I've fiddled around with various modifications but it seems to dislike "
[ -n "$TLC[i]" ] "
even though the 'while' loop is happy with it. That expression
evaluates to true or
false, does it not? So why won't 'for' swallow it?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author