I have a function printing a number
myFunc() {
echo 11
}
Now I want to use the number in expression in c style for-loop:
for (( i=1; i<=$(myFunc); i++ )); do
echo "$i"
done
Zsh gave me
test.sh:5: parse error near `i++ '
test.sh:6: parse error near `i<=$(myFunc); i++ ))...'
while Bash prints 1 through 11 as expected. What happened to Zsh? I expect it to be compatible with Bash on this feature.
In case it matters, my environment:
- OS X 10.11.5
- zsh 5.0.8 (x86_64-apple-darwin15.0)
- GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
update
This may be a bug, and may have been fixed in latest version. I will delete this question as soon as I verify this.
bash
.source filename
. It would take a lot of time to translate it to Zsh.