Hi,
In my shell script, (as per the requirement), I am creating few files, and the processes are launched parallelly . (by using "&" at the end of the command line). As per the logic, I need to remove these files as well, after creating.
But, the problem is, due to parallel processing, (while creation) if i am trying to remove the file, then it is not removing, because the previous process is in progress.
For this problem, I need to introduce some piece of code, (something like wait/sleep), which will give more time to complete these process and step for removing files won't be affected.
Ex-
(grep "pattern1" "file1" "file2" ;echo $? >> thread1.txt) &
(grep "pattern2" "file3" "file4" ;echo $? >> thread2.txt) &
------- Few lines of code ---------
rm -f thread1.txt thread2.txt
Hence, in between set of greps, and remove command, I need to use a piece of code, which will give some more time, to execute the grep to execute successfully. (can I use "sleep 1" over here ? or i need to use something else)
Please give some suggestion as this is very urgent for me.
Thanks for any kind of help.
Thanks and Regards,
Jitendriya Dash.