Q:

resolve ${1##*/} in shell script

In /etc/init.d/functions#_pids_var_run (which will be there in most Linux distros), i see a local variable initialization like this,
local base=${1##*/}

what does,
${1##*/} 

get resolved to?

A:

In bash scripts, ${varname##pattern} removes the longest prefix that matches pattern from varname. For example,
foo=bar/baz/qux
echo "${foo##*/}"

will print
qux

In the case of
${1##*/}

it will remove the longest prefix that matches */ from $1, which is the first parameter passed to the script/function.
In essence, it is a poor man's $(basename "$1").

