This is from a Bash shell script. The purpose is to get at the base
name of the script (which is contained within the script variable $0),
using the regular expression mode of expr.
.* matches 0 to infinity (the *) chars (the .) except for a newline,
and the escaped parentheses are needed to encapsulate that expression
for some reason. \.sh$ specifies ".sh" occurring at the end of a line
(escape needed to specify a literal .).
Please explain how this strips off the .sh extension. If you enter
dowhat.sh in Emacs, and search using this regular expression, it
happily matches the whole shebang, whereas as used in the script, the
extension is subtracted!
Good regular expressions tutorial: