Skip to content

no-backticks

Shellstylefix: safedefault: offshell/shellcheck

Reports a command substitution written with backticks.

Backticks cannot be nested without escaping, treat backslashes inside in their own way, and are easy to mistake for a quote. $(...) nests, and the quoting inside it is the same as outside.

To fix, write $(...).

Reported
now=`date`
echo "`date +%s`" done
esc=`printf "\\n"`
After the fix
now=$(date)
echo "$(date +%s)" done
esc=`printf "\\n"`
shell:
lint:
rules:
no-backticks: warn # off (default), warn, error

Enabled by the presets: shell/shellcheck.

Suppress one line with sudsy-disable-next-line no-backticks in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
shellcheck SC2006 full