Bash Bash Parameter Expansion Delete a pattern from the end of a string


Example

Shortest match:

$ a='I am a string'
$ echo "${a%a*}"
I am 

Longest match:

$ echo "${a%%a*}"
I