${var%sufixo}
It gnaws at the end of the value: % takes the smallest bite, %% the largest.
The mirror of #, aimed at the end: % removes the shortest match from the end, %% the longest. Reading % as "trim the tail" undoes the confusion with its sibling.
Two classics: ${arquivo%.*} drops the extension, ${caminho%/*} drops the name and the directory remains — dirname without a subshell.
$ arquivo=larvas.tar.gz
$ echo ${arquivo%.gz}
larvas.tar
$ echo ${arquivo%%.*}
larvas