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
Here's a snippet or screenshot that shows the problem:
# shellcheck shell=bash
# Prevent the file being sourced more than once by a script.
if [[ -z $alreadySourced ]]; then
readonly alreadySourced=YES
else
echo 'Already sourced!'
return 99
fi
readonly RET_CODE=1
function f0 {
echo 'in f0'
return $RET_CODE
}
Here's what shellcheck currently says:
In SHELLCHECKBUG line 15:
return $RET_CODE
^-------^ SC2086 (info): Double quote to prevent globbing and word splitting.
Did you mean:
return "$RET_CODE"
For more information:
https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
Here's what I wanted or expected to see:
No warning since the variable is a readonly integer.
Note:
changing the return on line 8 to exit removes the spurious warning, but return should be valid here.
adding a call of f0 also removes the warning, but since the file is a library of functions, not calling a function is expected.
changing # shellcheck shell=bash to #!/bin/bash has no effect on the spurious warning.
The text was updated successfully, but these errors were encountered:
For bugs
shellcheck --version
or "online"): 0.10.0 and onlineFor new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
No warning since the variable is a readonly integer.
Note:
return
on line 8 toexit
removes the spurious warning, butreturn
should be valid here.f0
also removes the warning, but since the file is a library of functions, not calling a function is expected.# shellcheck shell=bash
to#!/bin/bash
has no effect on the spurious warning.The text was updated successfully, but these errors were encountered: