[Asterisk-Users] Bug in my head or bug in the code?

Martin Pycko martinp at digium.com
Sat Sep 6 09:44:44 MST 2003


What does this step show on the CLI ?
exten => 1,1,SetVar(FOO=123**)
exten => 1,2,SetVar(CHECK=${FOO:-1:1})

? If you're going to see CHECK=* then there is a bug in = operator ...

Martin

On Fri, 5 Sep 2003, John Todd wrote:

> I am having Yet Another Regular Expression problem, but this one
> might not be my fault, or at least it might not be obviously my
> fault.  :-)
>
>
> exten => 2212,1,SetVar(FOO=123456**)
> exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = *])
>
> This script continues with a value of 0 in BAR.
>
> Similarly, none of the following changes made a difference in that
> result, which is expected since the * is not listed in
> README.variables as a character that must be escaped:
>
> exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "*"])
> exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = "\*"])
> exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = \*])
>
> I have also tried setting the variable ${BAZ}=*  and then using that
> in my comparison, with the same unexpected results.
>
> Oddly enough, this almost-identical example below has different, but
> "normal", results: BAR=1
>
> exten => 2212,1,SetVar(FOO=123456##)
> exten => 2212,2,SetVar(BAR=$[${FOO:-1:1} = #])
>
>
> What gives?  Am I colliding with a problem that is the result of the
> "*" character being used in expr evaluations and somehow not being
> handled correctly, or am I simply not implementing the syntax
> correctly?
>
> JT
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list