$0 is a special parameter available in POSIX compliant shells which refers to the name of the currently running process. This means that when it is used inside a shell it will return the name of the shell, and when it is used inside a script, it will return the name of the script, etc. Therefore, if you
echo it in terminal, you will see the name of the shell being output:
echo $0 # output: -zsh
Please note that the dash in front of the shell name has a special meaning. You might see it in the shell name output, depending on the way your shell was invoked.
Hope you found this post useful. It was published . Please show your love and support by sharing this post.