title: How to remove last n characters from a string in Bash?
body: <p>I have a variable <code>var</code> in a Bash script holding a string:</p>
  <pre><code>echo $var
  &quot;some string.rtf&quot;
  </code></pre>
  <p>I want to remove the last four characters of this string and assign the result to a new variable <code>var2</code>, so that</p>
  <pre><code>echo $var2
  &quot;some string&quot;
  </code></pre>
  <p>How can I do this?</p>