Back to Developer Roadmap

$0 in Shell Scripting

src/data/roadmaps/shell-bash/content/[email protected]

4.0724 B
Original Source

$0 in Shell Scripting

In shell scripting, $0 is a special variable that holds the name of the script being executed. It essentially represents the command used to invoke the script. This can be the script's filename, or if the script was invoked with a path, it will contain that path. $0 is useful for identifying the script itself within the script's code, for example, in logging or error messages.

Visit the following resources to learn more: