SC1098 – ShellCheck Wiki

See this page on GitHub


Quote/escape special characters when using eval, e.g. eval "a=(b)".

Problematic code:

eval $var=(a b)

Correct code:

eval "$var=(a b)"


Shells differ widely in how they handle unescaped parentheses in eval expressions.

Since the expression is evaluated as shell script code anyways, it should be passed in as a literal string without relying on special case parsing rules in the target shell. Quote/escape the characters accordingly.



ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.