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

[BUG] Bad escaping for a string with \$ sequence #593

Open
Ph0enixKM opened this issue Nov 14, 2024 · 0 comments · May be fixed by #594
Open

[BUG] Bad escaping for a string with \$ sequence #593

Ph0enixKM opened this issue Nov 14, 2024 · 0 comments · May be fixed by #594
Assignees
Labels
bug Something isn't working compiler

Comments

@Ph0enixKM
Copy link
Member

Describe the bug
It's possible to mistakenly interpolate value into Amber string the following way: "\$variable". This shouldn't be allowed as it creates a lot of potential issues.

To Reproduce
This snippet will interpolate not only the variable name, but also the value that it contains:

amber -e 'let var = 42; echo "\${nameof var}"';

It happens because with interpolation we evaluate this amber code to this bash output:

var=42
echo "$var"

And then it returns 42

Expected behavior
The example written above should compile to:

var=42
echo "\$var"

And return $var as it should

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant