-
-
Notifications
You must be signed in to change notification settings - Fork 348
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 for associative arrays when using gosh with -c vs without #884
Comments
Both seem to produce the same output on 5146d3e:
That said, the result looks wrong. Bash gives:
I assume that's the bug you refer to - looking. |
Shorter repro:
|
mvdan
added a commit
that referenced
this issue
Jun 29, 2022
That is, add support for "${array[@]}" for associative arrays, as well as "{!array[@]}" for indexed and associative arrays. We also add support for positional parameters in indirections, so that ${!@}, ${!*}, and ${!1} work the same as Bash. As usual, with plenty of tests. Fixes #884.
mvdan
added a commit
that referenced
this issue
Jul 3, 2022
That is, add support for "${array[@]}" for associative arrays, as well as "{!array[@]}" for indexed and associative arrays. We also add support for positional parameters in indirections, so that ${!@}, ${!*}, and ${!1} work the same as Bash. As usual, with plenty of tests. Fixes #884.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found this because task uses this and that's where it cropped up. So I came here and started trying to debug it and found gosh to use as a potential quick way to investigate.
It seems that when run without -c it iterates over each statement and executes them separately but when using -c it treats the whole file as a script. I guess there's something about context there that's being lost?
Anyway, consider this script:
The output will be quite different depending on whether you use -c with gosh or not. This exactly models the behavior I am seeing in task.
Is this a bug or am I (and the task project by extension) doing it wrong? Thanks!
The text was updated successfully, but these errors were encountered: