We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This code should trigger SC2128: Expanding an array without an index only gives the first element
SC2128: Expanding an array without an index only gives the first element
#!/bin/bash linevariable="var1 var2"; read -ra stringarray <<<"${linevariable}"; printf "first %s\\n" "${stringarray[0]}" printf "second %s\\n" "${stringarray[1]}" stringarray="${stringarray}" printf "stringarray %s\\n" "${stringarray[0]}"
But only this triggers it:
#!/bin/bash linevariable="var1 var2"; stringarray=(${linevariable}); printf "first %s\\n" "${stringarray[0]}" printf "second %s\\n" "${stringarray[1]}" stringarray="${stringarray}" printf "stringarray %s\\n" "${stringarray[0]}"
Related to:
The text was updated successfully, but these errors were encountered:
380221a
So it should! This failed because ShellCheck only looked for -a without accounting for things like -ra. This has now been fixed, thanks!
-a
-ra
Sorry, something went wrong.
No branches or pull requests
This code should trigger
SC2128: Expanding an array without an index only gives the first element
But only this triggers it:
Related to:
The text was updated successfully, but these errors were encountered: