SC1098 – ShellCheck Wiki

See this page on GitHub

Sitemap


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

Problematic code:

eval $var=(a b)

Correct code:

eval "$var=(a b)"

Rationale:

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.

Exceptions:

None.


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