There's a syntax error at the highlighted location. This will cause the shell to crash with a syntax error as well.
for
loop used on find
output SH-2044The usage of for
loops over find
output is fragile because it relies on word splitting and will evaluate globs. This will fail for filenames containing spaces, globbing, or regex characters and similar, such as My File.mp3
, MyFile[2008].mp3
. This also has a series of potential globbing issues depending on other filenames in the directory. For example: if you have MyFile2.mp3
and MyFile[2014].mp3
, the former file will play twice and the latter will not play at all (because [2014]
behaves as regex here, and MyFile2.mp3
will match this).
(( ))
doesn't support decimals SH-2079(( ))
doesn't support decimals. Some workarounds to this are to use commands such as bc
or awk
. Here are some examples.
#
SH-1099Found a keyword immediately followed by a #
. In order for the #
to start a comment, it needs to come after a word boundary such as a space.
There is an unquoted HTML entity, such as &
, >
or <
(instead of &
, >
and <
) in your code. It is recommended to replace HTML entities with their corresponding characters.
Problematic code:
<
SH-1038Detected use of <<(
, which is an invalid construct. You probably meant to redirect <
from process substitution <(..)
instead. To do this, a space is needed between the <
and <(..)
, i.e. < <(cmd)
.
(
or )
inside [[..]]
SH-1029You don't have to -- and can't -- escape (
or )
inside a [[ .. ]]
expression like you do in [ .. ]
. It is recommended remove the escaping.
Found a test expression [ ... ]
(POSIX) or [[ ... ]]
(ksh/bash) where the opening and closing brackets did not match (i.e. [[ .. ]
or [ .. ]]
). The brackets need to match up to work.
eof
is not on a separate line SH-1042Found eof
further down, but not on a separate line. Close matches include -eof
(!= eof
).
fi
statement here SH-1047Expected fi
matching previously mentioned if
statement.
Problematic code:
then
clause detected SH-1048$
used on the left side of an assignment SH-1066Unlike Perl or PHP, $
is not used when assigning to a variable.
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.
Problematic code:
(
found SH-1036The 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.
}
SH-1056Trying to escape something that has no special meaning when escaped. The backslash will simply be ignored here. If the backslash was supposed to be literal, it is recommended to enclose it in a single quote or escape it. If you wanted it to expand to something, rewrite the expression to use printf
(or in bash, $'\t'
).