-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
For bugs
- Rule Id (if any, e.g. SC1000): SC2230
- My shellcheck version (
shellcheck --versionor "online"): 4.4.7 (latest from git) - I tried on shellcheck.net and verified that this is still a problem on the latest commit
Here's a snippet or screenshot that shows the problem:
#!/bin/sh
which "$0"
/usr/bin/which "$0"
command -v "$0"
Here's what shellcheck currently says:
In test.sh line 3:
which "$0"
^-- SC2230: which is non-standard. Use builtin 'command -v' instead.
In test.sh line 4:
/usr/bin/which "$0"
^-- SC2230: which is non-standard. Use builtin 'command -v' instead.
Here's what I wanted or expected to see:
Because "command -v" does not do the same as which, I would have liked to see nothing.
When running the above (from /tmp), I get:
/tmp/test.sh
/tmp/test.sh
./test.sh
While "which" may not be standard, it is commonly used to get the full path.
At the very least I would like to not get warned when I specifically use the path as in the third command - then it's fairly certain what the user wants, which won't be the common bash alias.
brodygov, Dmole, fho, PatchMixolydic and aboliv3r
Metadata
Metadata
Assignees
Labels
No labels