What does a hash after a variable name do as an operator in bash?

Solution 1:

That is an example of prefix removal. The general form is:

 ${variable#pattern}

which removes the shortest match to the glob pattern from the beginning of variable. In your case, pattern consists of (a) * which matches zero or more of any character, and (b) = which matches just =.

See man bash for more info.

Example

$ i='ab=cd'
$ echo "${i#a}" 
b=cd
$ echo "${i#*=}" 
cd

Solution 2:

Bash Reference Manual

3.5.3 Shell Parameter Expansion

[…]

${parameter#word}

The word is expanded to produce a pattern just as in filename expansion (see Filename Expansion). If the pattern matches the beginning of the expanded value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern […] deleted.

Example

$ i='ab=cd'
$ echo "${i#a}" 
b=cd
$ echo "${i#*=}" 
cd

Shamelessly stolen from John's answer