title: bash shell script two variables in for loop
body: <p>I am new to shell scripting. so kindly bear with me if my doubt is too silly. </p>
  
  <p>I have png images in 2 different directories and an executable which takes an images from each directory and processes them to generate a new image. </p>
  
  <p>I am looking for a for loop construct which can take two variables simultaneously..this is possible in C, C++ etc but how do I accomplish something of the following. The code is obviously wrong. </p>
  
  <pre><code>#!/bin/sh
  
  im1_dir=~/prev1/*.png  
  im2_dir=~/prev3/*.png
  index=0
  
  for i,j in $im1_dir $im2_dir  # i iterates in im1_dir and j iterates in im2_dir 
  do
    run_black.sh $i $j  
  done
  </code></pre>
  
  <p>thanks!</p>