I am trying to understand the variable ${0##*/}
that I encountered in a bash script.
I understand that $0
contains the name, or the path, of the script, then ##
works as in ${parameter##pattern}
(source).
But I don't understand what the /
is doing here. I only know this kink of syntax with two slashes:${parameter/pat/string}
When I echo this variable in bash, I get bash
:)
Finally, I don't have the authorization to share the script. Let me just say that the variable is called SOFT="${0##*/}"
and is used in a printf
statement "Error message sent by $SOFT"