I am new to shell scripting. so kindly bear with me if my doubt is too silly.
I have png images in 2 different directories and an executable which takes an images f
This might be another way to use two variables in the same loop. But you need to know the total number of files (or, the number of times you want to run the loop) in the directory to use it as the value of iteration i
.
Get the number of files in the directory:
ls /path/*.png | wc -l
Now run the loop:
im1_dir=(~/prev1/*.png)
im2_dir=(~/prev3/*.png)
for ((i = 0; i < 4; i++)); do run_black.sh ${im1_dir[i]} ${im2_dir[i]}; done
For more help please see this discussion.