ShellCheck is a command-line tool that checks shell scripts for errors and common mistakes. It can detect syntax problems, suspicious commands, and other issues in Bash and shell scripts. It also provides suggestions to improve your scripts and make them easier to maintain.
Here’s what you can do with ShellCheck in Termux:
- Check shell scripts for common errors.
- Find syntax problems and suspicious commands.
- Detect incorrect variable usage.
- Get suggestions to improve shell scripts.
- Check Bash, sh, dash, ksh, and BusyBox scripts.
- Display warnings with different severity levels.
- Generate reports in JSON, GCC, and other formats.
- Enable additional checks for deeper analysis.
- Check sourced files and external scripts.
Install ShellCheck in Termux
You can easily install ShellCheck on Termux using the following command below. Just copy and run it in your Termux terminal.
First, update and upgrade the packages:
pkg update && pkg upgrade -yInstall ShellCheck:
pkg install shellcheck -yOnce the installation is complete, ShellCheck is ready to use.
Use ShellCheck in Termux
After installing ShellCheck, you can start checking your shell scripts for errors and common mistakes using the useful commands below.
Check a shell script:
shellcheck script.shCheck multiple shell scripts:
shellcheck script1.sh script2.shCheck a script using Bash:
shellcheck -s bash script.shCheck a script using the sh shell:
shellcheck -s sh script.shCheck sourced files:
shellcheck -a script.shEnable color output:
shellcheck -C always script.shDisable color output:
shellcheck -C never script.shShow only specific warning types:
shellcheck -i SC2086,SC2046 script.shExclude specific warning types:
shellcheck -e SC2086 script.shSet the minimum warning severity:
shellcheck -S warning script.shYou can also use
error,info, orstyleas the severity level.
Generate a JSON report:
shellcheck -f json script.shGenerate a GCC-style report:
shellcheck -f gcc script.shDisplay available optional checks:
shellcheck --list-optionalEnable all optional checks:
shellcheck -o all script.shEnable external source checking:
shellcheck -x script.shSkip local configuration files:
shellcheck --norc script.shSpecify a shell configuration file:
shellcheck --rcfile=.shellcheckrc script.shSet the source path for included files:
shellcheck -P SCRIPTDIR script.shShow the installed version:
shellcheck --versionShow the help menu:
shellcheck --helpThese commands let you check shell scripts, find common mistakes, control warning levels, and generate reports in different formats.
End Note
ShellCheck is a useful tool for finding syntax errors, common mistakes, and suspicious commands in your shell scripts, and you can use it to check your own scripts before running or sharing them to make sure your code is clean and works as expected.

