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

Re: Math expressions with 08 or 09 -> zsh2.6-beta10



> These leading zeros are inconsistent.  Math expressions do not seem to
> like numbers 08 or 09.

i dont know if this actually applies to this instances but ...

just a guess but isnt any number with a leading zero treated as an octal 
number(base 8)?

> 
>     zsh -f
>     % [ 03 -gt 07 ] && echo ok
>     % [ 07 -gt 03 ] && echo ok
>     ok
>     % [ 07 -gt 07 ] && echo ok
>     % [ 08 -gt 07 ] && echo ok
>     zsh: bad math expression: unbalanced stack

in this case the number '08' will be unrecognised...

>     % [ 07 -gt 08 ] && echo ok
>     zsh: bad math expression: unbalanced stack

in this case the number '08' will be unrecognised...


>     % [ 07 -gt 09 ] && echo ok
>     zsh: bad math expression: unbalanced stack

in this case the number '09' will be unrecognised...

> 
> in an effort to stip off the leading zero....
> 
>     % let x=01
>     % echo $x
>     1
>     % let x=07
>     % echo $x
>     7
>     % let x=08
>     zsh: lvalue required

in this case the number '08' will be unrecognised...

>     % echo $x
>     7

dont know about this - but it seems to be regressing to the last 
officially 'valid' set value.... ie '07'

>     % echo $ZSH_VERSION
>     2.6-beta10
> 

now i dont know if what i described is the supposed behaviour or not ...

dont grill me if i am wrong please ....... [my mail box is only so big..!]

matt.


Thought for the Day: Darth Vader sleeps with a Teddywookie.
__________________________________________________________________________
Prism Technologies Ltd.,    |                 Matt
KingFisher House, Kingsway, |  Tel No.    +44 (0)191 491 3983
Team Valley, Gateshead,     |  Fax No.    +44 (0)191 491 3973          
Tyne & Wear,                |  EMail.     mc@xxxxxxxxxxxxxxx
NE11  0JQ, U.K.             |  WWW Page   http://www.prismtech.co.uk/
__________________________________________________________________________



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