that evaluates to a number less than zero counts back from the end of the expanded value of $param.
W... ion.
Usually these commands are used within the "back tick" shell operators like TARGETDIR=`dirname $1`. The "back tick" operators are equivalent to the $(...) cons... tring}
Strips shortest match of $substring from back of $string.
${string%%substring}
Strips longes