dollar zero

The special parameter $0, which holds the name the current shell or script was started as.

In more detail

At the prompt it prints something like -bash or bash, and in a script it holds the path used to run the script. It reports the invoked name, so a program started through a link or as sh shows that name rather than the real program. Use it in usage messages so they name the script correctly.

Example

echo "$0"

Related terms

Taught in

References