1007
Remove space after = if trying to assign a value (for empty string
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.
Remove space after = if trying to assign a value (for empty string
Use semicolon or linefeed before 'fi' (or quote to make it literal).
\\r is just literal 'r' here. For carriage return
Use 'if cmd; then ..' to check exit code
Did you forget to close this double quoted string?
Shells disambiguate $(( differently or not at all. For $(command substition)
Shells disambiguate (( differently or not at all. For subshell
This is a unicode quote. Delete and retype it (or quote to make literal).
This is a unicode quote. Delete and retype it (or ignore/singlequote for literal).
Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames.
Use 'find .. -print0 | xargs -0 ..' or 'find .. -exec .. +' to allow non-alphanumeric filenames.
sudo doesn't affect redirects. Use sudo cat file | ..
The surrounding quotes actually unquote this. Remove or escape them.
Shell functions can't be passed to external commands.
If you wanted to assign the output of the pipeline
"=~ is for regex, but this looks like a glob. Use = instead."
This expression is constant. Did you forget the $ on a variable?
Quote parameters to tr to prevent glob expansion.
Quote the grep pattern so the shell won't interpret it.
Grep uses regex
To redirect stdout+stderr
Quote 'VS\_CMDS' to make here document expansions happen on the server side rather than on the client.
Tilde does not expand in quotes. Use $HOME.
Remove backticks to avoid executing output.
Remove exec " if script should continue after this command."
This assignment is only seen by the forked process.
This expansion will not see the mentioned assignment.
Use $((..)) for arithmetics
function' keyword is non-standard. Use 'foo()' instead of 'function foo'.
Use ${var:?}" to ensure this never expands to /usr ."
Assigning an array to a string! Assign as array
Brace expansions and globs are literal in assignments. Quote it or use an array.
This expands when defined
This action ignores everything before the -o. Use \\( \\) to group.
Injecting filenames is fragile and insecure. Use parameters.
This nested loop overrides the index variable of its parent.
This parent loop has its index variable overridden.
Not supported in dash
Found trailing ] outside test. Missing [?
Trapping signals by number is not well defined. Prefer signal names.
When used with -p
time' is undefined for pipelines. time single stage or bash -c instead.
Variable was used as an array but is now assigned a string.
Use array+=(item") to append items to an array."
This format string has 1 variables
Quote arguments to unset so they're not glob expanded.
Ash scripts will be checked as Dash. Add '# shellcheck shell=dash' to silence.
This redirection doesn't have a command. Move to its command (or use 'true' as no-op).
Elements in associative arrays need index
The arguments to this comparison can never be equal. Make sure your syntax is correct.
This word is constant. Did you forget the $ on a variable?
This pattern will never match the case statement's word. Double check them.
This is a file redirection. Was it supposed to be a comparison or fd operation?
This is a glob used as a command name. Was it supposed to be in ${..}
getopts specified -v
This case is not specified by getopts.
This flag is used as a command name. Bad line break or missing [ .. ]?
Piping to 'rm', a command that doesn't read stdin. Wrong command or missing xargs?
Redirecting to 'true'
Invalid flags are not handled. Add a *) case.
This pattern always overrides a later one.
This pattern never matches because of a previous pattern.
This ln has no destination. Check the arguments
Can't use sudo with builtins like cd. Did you want sudo sh -c .. instead?
Detect unknown binary operator
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.