Since it is called sequentially from the for loop, I was asked to make parellel copy to speed up.
I've done some thing like
for i in 1, 2 do:
doCopy &
PIDARR=&!
done
waitForAllCopiesFinish
In waitForAllCopiesFinish, I've a logic to wait till the PIDS in array are completed running and then I display "Completed"
But, my logic is not working. Whenever doCopy & is called, PID returns for some process called "bash" and there is some "cp" process parellely runs but I never see that PID returning. Not sure, how I get the PID for the "cp" process out of many "cp"s running in the system already.
Thank you. I will try this out and get back to you.
Regards
---------- Post updated at 08:42 PM ---------- Previous update was at 07:51 PM ----------
Hi Scott
Can I ask you one question?
I know that &! returns the last PID of the process that runs in the back ground, but with this, there are some issues like it may return some other PID which has just after your bkground job and before &!.
So. Do you think "wait %1 %2" always wait for the jobs that I run just in the background? or any chances of waiting for some other PIDs.