#!/bin/bash epnums=($(cat epnums.txt)) epurls=($(cat urls.txt)) mkdir ./tmp/ for n in ${!epnums[@]};do filename="./out/${epnums[${n}]}.jpg" wget -P ./tmp/ "${epurls[${n}]}" dlfile="$(find ./tmp/ -type f | head -n 1)" convert "${dlfile}" "${filename}" rm ./tmp/* done rm -r ./tmp/