Skip to content
Vidar Holen edited this page Feb 26, 2018 · 12 revisions

which is non-standard. Use builtin 'command -v' instead.

Problematic code:

which grep

Correct code:

command -v grep

Rationale:

which is a non-standard, external tool that locates an executable in PATH. command -v is a POSIX standard builtin, which uses the same lookup mechanism that the shell itself would.

Exceptions:

None

Related resources:

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally