When you write shell scripts, it's often the case the file name without extension, the extension etc is needed, to be able to modify the file names.
Traditionally one uses the commands basename and dirname.
But there's a better solution, to use operators in shell variables as sated in the chapter od the Bash Scripting FAQ about the subject.
Happy scripting ! !