Shell

Shell

Made by DeepSource
eof is not on a separate line SH-1042
Bug risk
Major

Found eof further down, but not on a separate line. Close matches include -eof (!= eof).

Whitespace detected between # and ! in the shebang SH-1115
Bug risk
Major

The script has spaces between the # and ! in the shebang. This is not valid. Remove the spaces so the OS can correctly recognize the file as a script.

Deprecated $[..] used SH-2007
Bug risk
Major

The $[..] syntax was deprecated in Bash 2.0 and replaced with the standard $((..)) syntax from Korn shell. It is therefore recommended to use $((..)) instead.

Consider using find instead of ls to better handle non-alphanumeric filenames SH-2012
Bug risk
Critical

Missing fi statement here SH-1047
Bug risk
Critical

Expected fi matching previously mentioned if statement.

Missing ! in shebang SH-1113
Bug risk
Major

You appear to be specifying a shebang, but missing the bang (i.e. !). The shebang should always be of the form #!/path/shell.

Executing output of a command SH-2091
Bug risk
Major

Remove surrounding $() to avoid executing output (or use eval if this is intentional).

Lexicographical comparison operator used for numerical comparison SH-2071
Bug risk
Critical

Syntax error SH-1070
Bug risk
Critical

There's a syntax error at the highlighted location. This will cause the shell to crash with a syntax error as well.

Single quote not escaped properly SH-1003
Bug risk
Major

Problematic code:

Escape \< to prevent it redirecting (or switch to [[ .. ]]) SH-2073
Bug risk
Critical

Mismatched keyword SH-1089
Bug risk
Critical

This error is typically seen when there are too many fis, dones or esacs , or when there's a do or then without a corresponding while, for or if.

Empty then clause detected SH-1048
Bug risk
Major

$ used on the left side of an assignment SH-1066
Bug risk
Critical

Unlike Perl or PHP, $ is not used when assigning to a variable.

Braces are required for positionals over 9 SH-1037
Bug risk
Major

For legacy reasons, $10 is interpreted as the variable $1 followed by the literal string 0. Curly braces are needed to tell the shell that both digits are part of the parameter expansion.

Consider using $HOME instead of tilde ~ to expand in quotes SH-2088
Bug risk
Major

Unicode single quote used SH-1016
Bug risk
Major

Problematic code:

Whitespace detected after the here-doc end token SH-1118
Bug risk
Major

The end token of your here document has trailing whitespace. This is invisible to the naked eye, but shells do not accept it.

Invalid or unescaped ( found SH-1036
Bug risk
Major

The checker expected an ordinary shell word but found an opening parenthesis instead. Determine what you intended the parenthesis to do and rewrite accordingly. Common issues include: * Wanting them to be literal, as in echo (FAIL) Some tests failed. In this case, it requires quoting.

Invalid use of parentheses SH-1088
Bug risk
Critical

Parentheses are special characters in shell and must be used correctly. For commands that expect literal parentheses, such as grep or find, the parentheses need to be quoted or escaped so the shell does not interpret them, and instead passes them to the command.