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 characters of this string and assign the result to a new variable var2, so that

echo $var2
"some string"

How can I do this?

12 Answers
12

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *