title: Generating the output file name from the input file in bash
body: <p>I have a bash script:</p>
  
  <pre><code>#!/bin/bash
  convert "$1" -resize 50% "$2"
  </code></pre>
  
  <p>Instead of passing two arguments while the script is run I want to mention just the source (or input file name) and the output file name should be auto-genarated from the source file name. Something like this <code>"$1" | cut -d'.' -f1".jpg"</code>. If the input file name was <code>myimage.png</code>, the output name should be <code>myimage.jpg</code>. <code>.jpg</code> should be appended to the fist part of the source file name. It should also work if the argument is: <code>*.png</code>. So how can I modify my script?</p>