What is this kind of argument parsing?
$RES="${SOME_VAR##foo/}"
${SOME_VAR##foo/} - bash variable substitution.
It search for match against the pattern foo/ from the start of the string (SOME_VAR variable's value) and truncates the left part including the pattern.
Example:
s="foo/some#foo#textfoo/textlast"
echo ${s##foo/}
some#foo#textfoo/textlast
Note, this ${s##foo/} is equivalent to ${s#foo/}, cause it searches only for the 1st occurrence of the pattern foo/ from the start of the string.
While this ${s##*foo/} will truncate the left part till the last matching pattern(inclusive)
echo ${s##*foo/}
textlast
According to man bash:
Parameter Expansion
The `$' character introduces parameter expansion, command substitution, or arithmetic expansion. The parameter name or symbol to be expanded may be enclosed in braces, which are optional but serve to protect the variable to be expanded from characters immediately following it which could be interpreted as part of the name.${parameter#word}
${parameter##word}
Remove matching prefix pattern.
The word is expanded to produce a pattern just as in pathname expansion. If the pattern matches the beginning of the value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the ``#'' case) or the longest matching pattern (the ``##'' case) deleted. If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list. If parameter is an array variable subscripted with @ or *, the pattern removal operation is applied to each member of the array in turn, and the expansion is the resultant list.