Open
Description
$ cat foo
#!/bin/bash
dosomething() {
local f="hello"
echo "hello"
}
source bar
$ cat bar
#!/bin/bash
hello() {
local f="abc"
echo "hi $f"
}
Now run shellcheck on foo', it complains correctly that variable
f' is not used.
$ shellcheck foo
In foo line 3:
local f="hello"
^-- SC2034 (warning): f appears unused. Verify use (or export if used externally).
In foo line 7:
source bar
^-^ SC1091 (info): Not following: bar was not specified as input (see shellcheck -x).
For more information:
https://www.shellcheck.net/wiki/SC2034 -- f appears unused. Verify use (or ...
https://www.shellcheck.net/wiki/SC1091 -- Not following: bar was not specif...
shell returned 1
But if you add bar
to the command line, then it will not fail.
$ shellcheck foo bar && echo GOOD
GOOD
In the above, variable f
is unused, but shellcheck assumes that because file bar
used a variable named f
, that it must have been intentional, even though bar declared f
.
Metadata
Metadata
Assignees
Labels
No labels