while read inum rest; do python3 restore_meta.py ${inum} /mnt/recovered/apr29/${inum}/ & while (( $(jobs -r | wc -l) >= 10 )); do wait -n 2>/dev/null || sleep 0.2 done done < true_roots.txt wait echo "All done"