title: UNIX remove characters from variable
body: <p>I want to remove the last 4 charachters from an input string and then use it in a sed command. But i can't get it to work properly</p>
  
  <p>newversion is an input parameter and it is set to: 5.5.5-dev.
  I want to remove -dev from the input parameter.</p>
  
  <p>What i have tried:</p>
  
  <pre><code>version=${$newversion::-4}
  sed -i "s|\(&lt;&lt;some name i defined&gt;&gt;/$imagename:\)\([^\n]*\)|\1$version|" docker-compose.yml
  </code></pre>
  
  <p>The error:</p>
  
  <p>Bad substitution</p>