madlambda/nash

Arguments of expr sum are concatenated in nash

ryukinix opened this issue · 1 comments

Trying evaluating a simple sum using the expr from gnu coreutils inside of nash shell I got this weird behavior:

[lerax@celeste ~]$ expr 1 + 2
3
[lerax@celeste ~]$ expr 1 + 2 + 3
6
[lerax@celeste ~]$ nash
λ> expr 1 + 2
12
λ> expr 1 + 2 + 3
123
λ>  

That occurs seems because Nash defines a concatenate operator as + and makes the statement expr 1 + 2 ambiguous. By another hand, If I escape the operator as a string I got the expected result:

λ> expr 1 "+" 2
3
λ> expr 1 "+" 2 "+" 3
6
λ>  

I don't know for sure if this is a feature or it is a bug, but I thought that would be good reporting this.

i4ki commented

Hello @ryukinix =)

Take a look: https://github.com/NeowayLabs/nash/issues/181

Yes, that's because for now nash only supports string. There is a proposal to extend the language to integers.