title: File name manipulation with shell scripts: changing file extensions
body: <p>I need to write a shell script to convert the image format from .png to .tif. The script is as follows: </p>
  
  <pre><code>#!/bin/sh
  
  for f in `ls *.png`
  do
      convert $f $f.tif
  done
  </code></pre>
  
  <p>But doing this will append the .tif format to the existing filename. ie if the image is abc.png the $f will have abc.png and after converting the filename becomes abc.png.tif. This is not what I want. I need it to be abc.tif. How do I manipulate $f to remove .png?</p>