You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For bash, a line ending with a backslash causes a false positive unless the backslash is proceeded with a space, eg:
echo"${@}"\
|less
The following script:
#!/bin/bashecho"1: This should not cause SC2145 error but does";echo"${@}"\
|less
echo"2: This should not cause SC2145 error but does";echo"${@}"\
|less
echo"5: This should not cause SC2145 error but does";echo"${@}"\
"test"echo"3: This correctly does not cause SC2145 error";echo"${@}"|less
echo"4: This correctly does not cause SC2145 error";echo"${@}" \
|less
echo"6: This correctly does not cause SC2145 error";echo"${@}" \
"test"echo"7: This correctly causes a SC2145 error";echo"${@} test"
Gives the following output:
In test.bash line 3:
echo "1: This should not cause SC2145 error but does"; echo "${@}"\
^--^ SC2145 (error): Argument mixes string and array. Use * or separate argument.
In test.bash line 6:
echo "2: This should not cause SC2145 error but does"; echo "${@}"\
^--^ SC2145 (error): Argument mixes string and array. Use * or separate argument.
In test.bash line 9:
echo "5: This should not cause SC2145 error but does"; echo "${@}"\
^--^ SC2145 (error): Argument mixes string and array. Use * or separate argument.
In test.bash line 20:
echo "7: This correctly causes a SC2145 error"; echo "${@} test"
^--^ SC2145 (error): Argument mixes string and array. Use * or separate argument.
The text was updated successfully, but these errors were encountered:
For
bash
, a line ending with a backslash causes a false positive unless the backslash is proceeded with a space, eg:The following script:
Gives the following output:
The text was updated successfully, but these errors were encountered: