How to separate the filename from the extension

BASH

filename=$(basename -- "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"