Forrest logo
back to the shellcheck tool

shellcheck:tldr:41651

shellcheck: Also check any sourced shell scripts.
$ shellcheck --checked-sourced ${path-to-script-sh}
try on your machine

The command "shellcheck --checked-sourced ${path-to-script.sh}" is used to run the ShellCheck tool on a shell script file and check it for any syntax errors or potential issues.

Let's break down each part of the command:

  1. "shellcheck": This is the command to run the ShellCheck tool.
  2. "--checked-sourced": This flag tells ShellCheck to check the sourced files as well. When a script sources another script, it means that it includes the code from that script into the main script.
  3. "${path-to-script.sh}": This is a placeholder for the actual path to the shell script file that you want to analyze. You need to replace "${path-to-script.sh}" with the actual path to your script file. For example, if your script is located in the home directory and named "script.sh", you would replace "${path-to-script.sh}" with "~/script.sh".

Overall, this command allows you to analyze a shell script for potential issues and offers suggestions to improve the code quality.

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