Hacker News new | ask | show | jobs
by account42 2168 days ago
> $0 means a filename of a file that is being executed.

This is only a convention and is entirely up to the calling program.

For example in bash scripts you can use `exec -a name ...` to pass "name" as the 0th argument.

If you are already using #!/bin/bash you might as well use ${BASH_SOURCE[0]} to get the path to the current script.