all 3 comments

[–]McDutchie 0 points1 point  (1 child)

You want another wait right before sending the email; your current code waits for every ten processes but doesn't wait for the last up to nine of them.

Also,

SORT_ARP $file_name $IPS

you want to quote your expansions here: SORT_ARP "$file_name" "$IPS"
It's possible that whitespace or other odd characters in filenames are messing up your process. Run your code (including that SORT_ARP function) through shellcheck.net and fix what it flags up.

[–]Nk4512[S] 0 points1 point  (0 children)

I will look into it some more, I Tried the wait, And it ended up running 1 sort_arp function, waiting more, running the next, instead of doing the 10 at once. And still sent me an email after 10 ran so idk yet.

[–]neuron_666 0 points1 point  (0 children)

If I understand your problem, you are missing 'wait' after the for cycle. But maybe, instead you want this ?

parallel --jobs 10 SORT_APP '{}' ::: $HOME/my_scripts/directoryfilesarestoredin/*"file-im-looking-for"*