SC2279 – ShellCheck Wiki

See this page on GitHub

Sitemap


$0 can't be assigned in Dash. This becomes a command name.

Problematic code:

#!/bin/dash
$0=myname

Correct code:

$0 can not be changed in Dash.

Rationale:

You appear to be trying to assign a new value to $0 in Dash.

Dash does not support this. Write around it, or switch to Bash.

Exceptions:

If you instead wanted to compare the value of $0, use a comparison like [ "$0" = "myname" ].


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