Is it possible to use parameter expansion to combine pattern-matching operators?
For example, given the variable test=/home/archie/.vimrc.bak
.
I can delete the longest match from the beginning of $test
with echo ${test##*/}
:
>> echo ${test##*/}
.vimrc.bak
I can also delete the shortest match from the end of $test
with echo ${test%.*}
:
>> echo ${test%.*}
/home/archie/.vimrc
Is there a way to combine the two pattern-matching operators to output .vimrc
?