Medium

Showing all detectors for the Shell language with medium severity.

Ineffective Variable Assignment

Variable assignment before command execution not affecting the current shell environment.

Variable Assignment Syntax

Proper syntax for variable assignments in shell scripting without spaces around the equals sign.

SSH Stdin Interference

SSH command unexpectedly consuming stdin, causing loop iteration issues.

Glob Pattern Safety

Use './glob' or '-- glob' to prevent dash-prefixed filenames from becoming options.

Sensitive bourne shells

Bourne shells are sensitive to whitespace, where spaces can change script behavior.

Avoid LS-Grep

Prefer globs or loops over ls-grep.

Shebang Mismatch

Avoid non-standard features in '/bin/sh' scripts.

Unicode Dash In Command

Shell script uses a Unicode dash instead of ASCII minus, causing syntax errors in commands or expressions.

Ensure no spaces are used

Ensure no spaces are used when assigning values in code.

Grouping expressions

Avoid using square brackets to group subexpressions inside square bracket statements.

Leading Zero Arithmetic

Avoid using leading zeros in numeric literals in shell arithmetic.

Missing exec Terminator

Incorrect usage of '-exec' in shell scripts, leading to unexpected behavior.

Semicolons directly after else

Remove semicolon directly after else.

Array Element Separation

Separate array elements with spaces, not commas, in shell scripts.

Invalid Unary Test Operator

Use of non-existent unary operator in test expression.

Shebang Placement

Shebang not on the first line of the script.

Incorrectly used escape sequences

The problem involves replacing literal '\t' with actual tab characters using the command $(printf '\t').

Improper use of curly braces

Improper use of '{'' in commands affects syntax, when not treated as a separate token, it can lead to errors.

Missing Space Before Colon

Space missing before colon in shell script.

Pipeline Assignment Syntax

Incorrect syntax for assigning pipeline output to a variable.

Here-Document Command Terminator Placement

Place command terminators on the line with the here-document initiator.

Test operator missing an operand

It detected a test operator missing an operand.

Expr Modernization

Replace 'expr' with modern shell constructs.

Missing Function Opening Brace

A function definition lacking the opening curly brace {, causing syntax error in shell.

Arithmetic Expression Syntax

Missing dollar sign in arithmetic expression.

Reversed Shebang

Shell script uses reversed shebang (!#) instead of the correct form (#!).

Command Substitution Execution

Unintended execution of command output due to unnecessary command substitution.

Unsupported Decimal Comparison

Shell scripts cannot natively handle decimal comparisons.

Semicolons directly after then

Remove semicolons immediately following the keyword 'then'.

ShellCheck Directive Placement

Place ShellCheck directives before complete compound commands.

Missing Space After Function Name

Shell script function declaration lacks required space or newline between function name and body.

Unquoted Regex Matching

Don't quote the right-hand side (RHS) of the '=~' operator, as it causes the pattern to be treated as a literal string rather than a regular expression.

Missing Space Before Negation

Space missing before negation operator in shell command.

Redirection Misinterpretation

Preventing shell from interpreting a comparison as a file redirection.

Unexpected Directive

Unexpected or incorrectly formatted shellcheck directive.

Unquoted Special Parameters

Use quoted special parameters to prevent word splitting and globbing.

Command Expansion Error

Use '$(..)' for command substitution instead of '..'.

Do not use unicode non-breaking space

Delete the unicode non-breaking space and replace it with a regular space.

Unquoted Command Substitution

Avoid unquoted command substitutions to prevent word splitting and globbing.

Incorrect Redirection Order

Incorrect order of stdout and stderr redirection in shell scripts.

Unexpected opening parenthesis

An unexpected opening parenthesis was found, revise your script to clarify its intended use.

Incorrect Regex Operator

Incorrect regex operator usage.

Single-Iteration Loop

Ensure for loops iterate over multiple values.

File Read-Write Race Condition

Simultaneous reading and writing of the same file in a pipeline, leading to data loss or corruption.

Invalid Parentheses Usage

Shell script contains syntax error due to invalid use of parentheses, causing parsing to fail.

Shebang Syntax Correction

Eliminate spaces between '#' and '!' in the shebang.

Unquoted tr Arguments

Lack of quotes around 'tr' command arguments.

Use shell logical operators

Grouping inside square bracket is not preferred; use shell logical operators instead.

Incorrect Command Substitution in Find Exec

Ensure correct command expansion when using find's -exec option.

Non-empty then clause

Shells require non-empty then clauses; use a dummy command like true for a no-operation.

Suspicious End Quote

Potential quote termination issue.

Directive Comment Syntax

Use proper syntax for comments in ShellCheck directives.

Unmatched Keyword

Shell script contains an unmatched or extra keyword, causing a syntax error and parsing failure.

Prefer Find Over LS

Use 'find' for file operations instead of 'ls'.

Missing Do Keyword

A loop that appears to be missing a do statement, causing syntax error in shell script.

Then after if statement

The script has a parsing error indicating a missing 'then' keyword after 'if' or 'elif' conditions.

Invalid Test Operator Usage

Use of non-existent binary operator in test expression.

Null-Terminated Filename Handling

Use null-terminated filenames with 'find' and 'xargs'.

Function in External Command

Shell functions cannot be passed to external commands.

Unquoted RHS Comparison

Quote the right-hand side of equality operators in Bash conditional expressions.

Incorrect Keyword Capitalization

Shell script uses incorrectly capitalized keyword, leading to syntax error.

Unquoted Array Expansion

Missing quotes around array expansion.

Unnecessary Exec Command

Unintended termination of script execution due to misuse of 'exec' command.

Constant Comparison

Ensure variables are properly referenced in shell comparisons.

Incorrect Logical Operator

Incorrect use of logical OR (||) instead of AND (&&) in conditional checks.

Command Assignment

Use '$(cmd)' for command output assignment.

Incorrect Numeric Comparison

Incorrect use of string comparison operator instead of numeric comparison in shell scripts.

Here-doc Whitespace

Remove trailing whitespace after here-document end token.

UTF-8 BOM Present

Shell script file contains a UTF-8 Byte Order Mark (BOM), potentially causing execution issues.

PS Grep Alternative

Use pgrep for process lookup.

Glob Matching in Test Brackets

Use double square brackets for glob pattern matching in shell scripts.

Here-Document End Token Isolation

Keep the here-document end token on a separate line without additional content.

Unnecessary Quoting in Loop

Ensuring that command substitution in for loops is properly handled to get the intended iteration behavior.

Here-doc Comment

Avoid comments on the same line as here-document end token.

Unquoted Grep Patterns

Lack of quotes around pattern arguments in 'grep' command.

Find Print Zero Usage

Using 'find -print0' or 'find -exec' for safer file handling

Misused Regex Operator

Use correct operator for pattern matching in shell conditionals.

Incorrect Branching Keyword

Incorrect use of 'elseif' or 'elsif' instead of 'elif' in shell scripts.

Invalid unary test operator usage

Identified an invalid unary test operator usage.

Detects if statement without terminator

Detects an if statement without a matching terminating fi.

Unquoted Find Patterns

Lack of quotes around pattern arguments in 'find' command.

Unexpected Redirection in Comparison

Incorrect use of the less-than '<' or greater-than '>' operator in shell conditional expressions.

Missing Spaces in Comparison

Ensure spaces around comparison operators.

Misplaced Line Continuation Operator

Pipe, OR, or AND operators incorrectly placed at the start of a line.

POSIX Shell Compatibility

Ensure script adheres to POSIX shell standards.

Arithmetic Expansion Command Execution

Prevent unintended command execution from arithmetic expansions.

Brace Expansion Limitation

Avoid using variables in brace range expansions in Bash.

Braces required for positionals

Certain variables are interpreted as another variable followed by a literal string, needing curly braces for clarity.

Variable Indirection

Invalid variable assignment. Use arrays, declare, or read/eval for indirection.

Use of if and then

The problem involves checking the exit code or output of a command in a shell script using different conditional constructs.

Incorrect Equality Operator

Shell script uses == for assignment or comparison outside of test brackets.

Unescaped Variable in Remote Command

Properly escape variables in remote commands to prevent premature expansion.

Keywords being used as arguments

Identified keywords being used as arguments instead of shell commands, leading to improper interpretation.

Find Loop Safety

Use safe alternatives to iterate over find output.

Read Lines with While Loop

Use while loop for line-by-line processing.

Unclosed String

Double-quoted string is not properly closed.

Unclosed Do Statement

A loop structure with do keyword lacking the corresponding done, causing syntax error in shell script.

Source Parsing Failed

ShellCheck unable to parse a sourced file, leading to incomplete analysis.

Unintended Literal Brace

Shell script contains literal braces where command grouping or parameter expansion may be intended.

Incorrect Function Parameter Declaration

Incorrect attempt to declare function parameters in shell script, leading to potential errors.

Subshell Variable Modification

Variable modified in a subshell, potentially losing changes.

Shell Alias Nesting

Shell alias incorrectly nests single quotes, causing syntax errors.

Here-Doc Termination Linefeed

Insert a linefeed between here-document end token and closing parenthesis.

Incorrect Grep Pattern

Using glob syntax instead of regular expressions in grep commands.

Remove indentation before end token

Remove indentation before the end token (or use <<- and indent with tabs).

Incorrect Conditional Syntax

Incorrect use of else if.

Remove Leading Spaces Before Shebang

Eliminate spaces preceding the shebang line.

Missing Dollar Sign

Ensure variables are properly referenced with a '$' sign.

Missing Shebang

Missing exclamation mark in shebang line.

Premature Variable Expansion

Variable expansion occurs before assignment, resulting in unintended values.

Unquoted Variable in Test

Unquoted variables in test expressions causes unexpected script behavior or errors.

Here Document Expansion Control

Quote the 'EOF' delimiter in here documents for remote execution.

Arithmetic Expansion Modernization

Use the modern '$((..))' syntax for arithmetic operations.

Dollar Sign In Assignment

Incorrect use of $ symbol on the left side of variable assignments in shell script.

Command Substitution Syntax

Use '$(...)' instead of backticks for command substitution.