Skip to content

shellcheck

config file
# $HOME/.shellcheckrc or /path/to/project/.shellcheckrc
shell=bash
disable=SC2068,SC1000
enable=check-unassigned-uppercase
cli
set shell dialect (sh, bash, ...)
shellcheck -s sh /path/to/file
disable errors in specific run
shellcheck -e SC2068 /path/to/file
enable optional checks in specific run
shellcheck -o check-unassigned-uppercase /path/to/file
check sources scripts
shellcheck --checked-sourced /path/to/file
output format
shellcheck --format json /path/to/file
shellcheck --format diff /path/to/file
script
enable optional checks globally
#!/bin/bash
# shellcheck enable=check-unassigned-uppercase
disable errors globally
#!/bin/bash
# shellcheck disable=SC2068,SC1234
disable errors specifically
# shellcheck disable=SC2068
echo $FOOBAR
enable optional checks specifically
# shellcheck enable=check-unassigned-uppercase
echo $FOOBAR
set/override shell specifically
# shellcheck shell=bash
if [ "$a" == "$b" ]; then echo "equal"; fi

last updated: Sat Aug 12 14:29:24 2023

Back to top