Forrest logo
back to the shellcheck tool

shellcheck:tldr:0c1b2

shellcheck: Check a shell script interpreting it as the specified shell dialect (overrides the shebang at the top of the script).
$ shellcheck --shell ${select} ${path-to-script-sh}
try on your machine

The command shellcheck is a program used to analyze shell scripts for potential issues and provide suggestions for improvement.

Here's a breakdown of the command:

  1. shellcheck: This is the actual command for running the Shellcheck program.

  2. --shell: This option specifies the shell dialect to be used for analysis. ${select} is a placeholder for a shell dialect, such as bash, sh, ksh, etc. This option helps Shellcheck understand the syntax and features specific to the chosen shell.

  3. ${path-to-script.sh}: This is a placeholder for the path to the shell script file that you want to analyze. It could be something like /path/to/script.sh. The file will be analyzed for potential issues using the selected shell dialect specified in ${select}.

Therefore, when you run this command, Shellcheck performs an analysis of the shell script file (${path-to-script.sh}) using the specified shell dialect (${select}), pointing out any possible errors or best practices that could improve the script.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the shellcheck tool