Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arguments of expr sum are concatenated in nash #270

Closed
ryukinix opened this issue Aug 27, 2018 · 1 comment
Closed

Arguments of expr sum are concatenated in nash #270

ryukinix opened this issue Aug 27, 2018 · 1 comment

Comments

@ryukinix
Copy link
Member

ryukinix commented Aug 27, 2018

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.

@ryukinix ryukinix changed the title Unexpected behavior of expr inside of nash: arguments are concatenated Unexpected behavior of expr in nash: arguments are concatenated Aug 27, 2018
@ryukinix ryukinix changed the title Unexpected behavior of expr in nash: arguments are concatenated Arguments of expr sum are concatenated in nash Aug 27, 2018
@i4ki
Copy link
Collaborator

i4ki commented Aug 27, 2018

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.

@i4ki i4ki closed this as completed Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants