Artificial intelligent assistant

Bash parameter expansion - greedy versus non-greedy It's a bit of a contrived example but here goes: Say I have a variable `1.2.3.4` containing version information and need to replace the `.4` at the end with `.5` version=1.2.3.4 echo ${version%.*}.5 1.2.3.5 #no problem But when I attempt to "in-line" the substitution with `/` and a `%` anchor echo ${version/%.*/.5} 1.5 Bash does a greedy substitution. Is there a way to have bash take the substitution up "non-greedily" so I can use substitution as a replacement for the earlier delete+append approach?

Not in general but easily in this case:


shopt -s extglob
echo ${version/%+([0-9])/}
1.2.3.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 271b17b3c1930e311f1bbc7d1b20feda