I have a variable var in a Bash script holding a string, like:
echo $var
\"some string.rtf\"
I want to remove the last 4 chara
In this case you could use basename assuming you have the same suffix on the files you want to remove.
Example:
basename -s .rtf "some string.rtf"
This will return "some string"
If you don't know the suffix, and want it to remove everything after and including the last dot:
f=file.whateverthisis
basename "${f%.*}"
outputs "file"
% means chop, . is what you are chopping, * is wildcard