What it basically does is returns the name of the program or script you are running. If you just run it in a bash shell, you are running bash, so that's what it will return. The
${ ... } is used to surround a variable, and will return the value of that variable.
$0 is a positional parameter (see here:
http://bashscripts.org/forum/viewtopic.php?f=15&t=491) and the 0th parameter is the name of the script that was used to execute it, including the path if one was used; that's what the 0 is for. The
## is to match the largest possible substring that matches the following pattern within the preceding variable's value. In this case, the pattern is
*/ which will match anything that ends with a '/' because
* is a wildcard. So, in short, this removes the path preceding the script name that you are running (if it exists).