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

Revisit simple parameter expansion #16

Open
pombredanne opened this issue Jul 17, 2021 · 0 comments
Open

Revisit simple parameter expansion #16

pombredanne opened this issue Jul 17, 2021 · 0 comments

Comments

@pombredanne
Copy link
Collaborator

pombredanne commented Jul 17, 2021

The simple parameters such as $foo or ${bar} are expanded by simple replacement which may not be entirely correct

In expand_simple() we need to validate if a plain replace is really what is supposed to happen in particular simple expansion may need to happen on tokens rather than on the whole string.

For instance, with foo=bar, abc$fooBAR does not expand in Bash

Also foo=BUZ;foobar=BAZ;echo "$foobar" which means the longest parameter name is matched first and we do not apply this correctly.

pombredanne added a commit to aboutcode-org/parameter_expansion_patched that referenced this issue Jul 18, 2021
parameters are sorted by decreasing length such that we expand first
the longest names.

Signed-off-by: Philippe Ombredanne <[email protected]>
pombredanne added a commit to aboutcode-org/parameter_expansion_patched that referenced this issue Jul 18, 2021
parameters are sorted by decreasing length such that we expand first
the longest names.

Signed-off-by: Philippe Ombredanne <[email protected]>
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

1 participant