1008
This shebang was unrecognized. Note that ShellCheck only handles sh/bash/dash/ksh.
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.
This shebang was unrecognized. Note that ShellCheck only handles sh/bash/dash/ksh.
Don't put spaces around the = in assignments (or quote to make it literal).
This } is literal. Check expression (missing ;/\\n?) or quote it.
Use braces when expanding arrays
Can't follow non-constant source. Use a directive to specify location.
Unexpected ==. For assignment
Remove leading spaces before the shebang.
Backslash is literal in \\’". Prefer explicit escaping: "\\\\’"."
See if you can use ${#variable} instead.
See if you can use ${variable//search/replace} instead.
Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
expr is antiquated. Consider rewriting this using $((..))
$/${} is unnecessary on arithmetic variables.
Useless echo? Instead of 'echo $(cmd)'
Use $(...) notation instead of legacy backticked `...`.
Use $((..)) instead of deprecated $[..]
Use find instead of ls to better handle non-alphanumeric filenames.
To read lines rather than words
Expressions don't expand in single quotes
Variable appears unused. Verify use (or export if used externally).
Use ./*glob* or -- *glob* so names with dashes won't become options.
Use -print0/-0 or -exec + to allow for non-alphanumeric filenames.
Undefined keyword for POSIX sh
This loop will only ever run once for a constant value. Did you perhaps mean to loop over dir/*
For loops over find output are fragile. Use find -exec or a while read loop.
Iterating over ls output is fragile. Use globs.
Use $@" (with quotes) to prevent whitespace problems."
Quote the right-hand side of != in [[ ]] to prevent glob matching.
Don't use variables in the printf format string. Use printf ..\%s.." "$foo"."
Quote the parameter to -iname so the shell won't interpret it.
Use single quotes
Double quote array expansions to avoid re-splitting elements.
> is for string comparisons. Use -gt instead.
Quotes/backslashes will be treated literally. Use an array.
Quotes/backslashes in this variable will not be respected.
Remove surrounding $() to avoid executing output.
Make sure not to read and write the same file in the same pipeline.
Use a ( subshell ) to avoid having to cd back.
function' keyword is non-standard. Delete it.
Useless echo? Instead of 'cmd $(echo foo)'
Use $@" if function's $1 should mean script's $1."
A function references arguments but no argument is passed
To assign a variable, do not use set
Consider using grep -c instead of grep|wc -l.
Expanding an array without an index only gives the first element.
Consider using { cmd1; cmd2; } >> file instead of individual redirects.
Word is of the form A"B"C" (B indicated). Did you mean "ABC" or "A\\"B\\"C"?"
Use egrep -q instead of comparing output with [ -n .. ].
Argument mixes string and array. Use * or separate argument.
Tips depend on target shell and yours is unknown. Add a shebang.
Possible misspelling: FGREP may not be assigned
xtra is referenced but not assigned.
Declare and assign separately to avoid masking return values.
Instead of '[ true ]', just use 'true'
Instead of '[ 1 ]', just use '1'
read without -r will mangle backslashes.
This does not export 'atom\_env\_pair'. Remove $/${} for that
Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
Quote this invalid brace expansion since it should be passed literally to eval.
Check exit code directly with e.g. 'if mycmd;'
Some finds don't have a default path. Specify '.' explicitly.
tempfile is deprecated. Use mktemp instead.
The = here is literal. To assign by index
egrep is non-standard and deprecated. Use grep -E instead.
Arrays don't work as operands in [ ]. Use a loop (or concatenate with * instead of @).
Quote to prevent word splitting/globbing
Prefer mapfile or read -a to split command output (or quote to avoid splitting).
Use var=$(command) to assign output (or quote to assign string).
Instead of 'let expr'
This default assignment may cause DoS due to globbing. Quote it.
which is a non-standard tool. Use builtin 'command -v' instead.
Quote expansions in this for loop glob to prevent wordsplitting
Remove superfluous (..) around condition.
Remove superfluous (..) around test command.
Use { ..; } instead of (..) to avoid subshell overhead.
Use -n instead of ! -z.
Use [ -n .. ] instead of ! [ -z .. ].
Remove indentation before end token
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.