SC2083 – ShellCheck Wiki

See this page on GitHub

Sitemap


Don't add spaces after the slash in ./file.

Problematic code:

gcc -o myfile file.c
./ myfile

Correct code:

gcc -o myfile file.c
./myfile

Rationale:

Contrary to popular belief, there is no command or syntax ./ that runs a file.

./myfile is simply the shortest path equivalent to myfile that specifies a directory and therefore causes a shell to run it as-is, instead of trying to find its directory using $PATH.

Therefore, to run a file in the current directory, use ./myfile and not ./ myfile.

Exceptions:

None


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.