title: Script for batch processing files in sequence
body: <p>I need some help writing a bash script to invoke a command line program to do batch processing. What I want to do is to invoke a command line program called enfuse, which combines multiple images of varying exposure into one image.</p>
  
  <p>Enfuse is invoked by typing this into a terminal: </p>
  
  <pre><code>enfuse [options] [input files]
  </code></pre>
  
  <p>If I want to enfuse, say, 2 images (0000.jpg and 0001.jpg) together, with an output file of A0001.jpg I would type in</p>
  
  <pre><code>enfuse -o A0001.jpg 0000.jpg 0001.jpg
  </code></pre>
  
  <p>However, this is not what I want to do. I have a folder of images where the images are named sequentially (say, 0000.jpg, 0001.jpg...1000.jpg), where I want to enfuse multiple brackets of images, and each bracket consits of 2 images (0001.jpg &amp; 0002.jpg will be the first bracket, and 0003.jpg and 0004.jpg will be the second bracket and so on)</p>
  
  <p>How might I write a script that invokes enfuse to run on all my images, 2 images at a time, with output names that are sequential (A0001.jpg, A0002.jpg...)? Enfuse can work with wildcards as input files, but I don't want the entire folder to be fused into one image, so I can't just put in *.jpg as the input files.</p>