Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: evaluating a condition



On Sep 12,  8:41pm, Gaspar Bakos wrote:
} Subject: evaluating a condition
}
} I have the following script, and I would like to print the numbers in the
} terminal from ${min} to ${max}, if both of them are smaller than 10.

At first I thought you'd found a bug in the math parser, but:

} export min=$3;export max=$4;
}         if (($[min]<10 && $[max]<10)) then
                           ^^
There's a metafied space here.  I think zsh is interpreting "\240$[max]" as
an identifier; e.g. if max=11, the identifier name is "\240\061\061".  That
identifier isn't defined, so it's value is 0 which is always < 10.

} 	        for i in {${min}..${max}}; do echo $i; done
}         fi

This is a danger of permitting identifiers to contain non-ascii characters.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author