I want to remove the file name extension from a variable based on the extension pattern. Currently, I am interested only to remove two extensions - exe and .cat. I can achieve this using multiple commands. But, wondering if there is a short cut available with a single command.
filename=testfile.exe file=${testfile%.exe}
This will give me the output as "testfile" but if my filename now is: filename=testfile.cat I will have to again run: file=${testfile%.cat}
I want a single command which will give me "testfile" as output.
I don't want to use file=${testfile%.*} as this will remove all the extensions of all other undesired types.
Thanks in Advance!