special-parameter

Bash $0 — invocation name

For a script, the invocation name; for bash -c, the first argument following the command string if supplied. Not counted by $#.

Formal Syntax & Structure

bash syntaxbash
$0

Return Value

string

Shell or script invocation name.

Working Example

Example Snippetbash
bash -c 'printf "name=%s count=%s\n" "$0" "$#"; printf "first=%s second=%s\n" "$1" "$2"' demo 'New York' report
Bash Reference