BACK TO LIST

Shell rules

Bash, zsh, ksh: regardless what Shell you use, Codiga got you covered. With hundreds of rules, the Codiga Static Engine checks for any issue in your shell script and surfaces issues in your Shell codebase.

1001

Error prone
Warning

This \\N will be a regular 'N' in this context.

1003

Error prone
Warning

Want to escape a single quote? echo 'This is how it'\\''s done'.

1004

Error prone
Warning

This backslash+linefeed is literal. Break outside single quotes if you just want to break the line.

1009

Error prone
Warning

The mentioned syntax error was in this elif clause.

1079

Error prone
Warning

This is actually an end quote

1091

Error prone
Warning

Not following: /etc/os-release was not specified as input (see shellcheck -x).

2009

Error prone
Warning

Consider using pgrep instead of grepping ps output.

2014

Error prone
Warning

This will expand once before find runs

Learn more

2015

Error prone
Warning

Note that A && B || C is not if-then-else. C may run when A is true.

2017

Error prone
Warning

Increase precision by replacing a/b*c with a*c/b.

2018

Error prone
Warning

Use '[:lower:]' to support accents and foreign alphabets.

2019

Error prone
Warning

Use '[:upper:]' to support accents and foreign alphabets.

2020

Error prone
Warning

tr replaces sets of chars

2021

Error prone
Warning

Don't use [] around classes in tr

2022

Error prone
Warning

Note that unlike globs

2023

Error prone
Warning

The shell may override 'time' as seen in man time(1). Use 'command time ..' for that one.

2026

Error prone
Warning

This word is outside of quotes. Did you intend to 'nest ''single quotes'"' instead'? "

2028

Error prone
Warning

echo won't expand escape sequences. Consider printf.

2029

Error prone
Warning

Expansion on the client side

2030

Error prone
Warning

Modification of RSYSLOG\_VERSION is local (to subshell caused by pipeline).

2031

Error prone
Warning

RSYSLOG\_VERSION was modified in a subshell. That change might be lost.

2032

Error prone
Warning

Use own script or sh -c '..' to run this from sudo.

2102

Error prone
Warning

Ranges can only match single chars (mentioned due to duplicates).

2166

Error prone
Warning

Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

2197

Error prone
Warning

fgrep is non-standard and deprecated. Use grep -F instead.

2254

Best practice
Warning

Quote expansions in case patterns to match literally rather than as a glob

1133

Code style
Warning

Unexpected start of line. If breaking lines, |/||/&& should be at the end of the previous one.

1112

Error prone
Warning

This is a unicode quote. Delete and retype it (or ignore/doublequote for literal).

2218

Error prone
Warning

This function is only defined later. Move the definition up.

2238

Best practice
Warning

Redirecting to/from command name instead of file. Did you want pipes/xargs (or quote to ignore)?

2229

Error prone
Warning

This does not read foo. Remove $/${} for that, or use ${var?} to quiet

2065

Error prone
Warning

This is interpreted as a shell file redirection, not a comparison

1130

Code style
Warning

Need a space before :

2227

Error prone
Warning

Redirection applies to the find command itself.

2170

Error prone
Warning

Invalid number for -eq. Use = to compare as string

We use cookies to improve your site experience, including analytics cookies to understand how you use our product and design better experiences. Please read our Cookie Policy.