#!/bin/bash # Number of parallel jobs N=8 # Loop through the images in chunks of $N for ((i=0; i<$(ls frames/ | wc -l); i+=N)); do # Launch $N jobs in parallel for ((j=0; j