“There are also expansions for removing prefixes and suffixes.
The form ${VAR#pattern} removes any prefix from the expanded value
that matches the pattern. The removed prefix is the shortest
matching prefix, if you use double pound-signs/hash-marks the
longest matching prefix is removed. Similarily, the form
${VAR%pattern} removes a matching suffix…”
Bash Parameter Expansion
By
Mitch Frazier
Get the Free Newsletter!
Subscribe to Developer Insider for top news, trends, & analysis