title: How to create a bash script that takes arguments?
body: <p>I already know about getopts, and this is fine, but it is annoying that you have to have a flag even for mandatory arguments.</p>
  
  <p>Ideally, I'd like to be able to have a script which receives arguments in this form:</p>
  
  <pre><code>script.sh [optional arguments] [anything required]
  </code></pre>
  
  <p>for example</p>
  
  <pre><code>script.sh -rvx output_file.txt
  </code></pre>
  
  <p>where the script says you HAVE to have an output file.  Is there any easy way to do this?</p>
  
  <p>As far as I know, with getopts it would have to look like: <code>script.sh -rvx -f output_file.txt</code>, and that is just not very clean.</p>
  
  <p>I can also use python if necessary, but only have 2.4 available, which is a bit dated.</p>