Denny Huang says to YSITD
#!/bin/bash function download { line=$1 if [ -z "`grep $line json_fetched`" ] then echo "Fetching $line" mongo nhentai --eval "db.nhentai.insert(`curl https://nhentai.net/g/$line/ | grep -oP 'var gallery = new N.gallery\(\K.*(?=\);)'`)" echo "$line" >> json_fetched else echo "$line Already Fetched" fi } export -f download cat list | parallel --bar download