Hi,
How to use the return code, for parallel running threads.
Ex-
grep pattern1 file1 file2 file3 file4 &
grep pattern1 file5 file6 file7 file8 &
grep pattern1 file9 file10 file11 file12 &
return_code=$?
if (return_code -eq 0)
then
echo "pattern found"
else
echo "pattern not found"
fi
Here, in this above samples of code, how to use return codes effectively, for the concurrent running greps, so that, i can get correct result for, "pattern1" is found in which grep.
It seems that, I need to use the thread locking and unlocking principle here. However, i am a bit confused, how to use this concept over here.
Please help.
Please indicate, if you need any further clarification of the problem.
Thanks and Regards,
Jitendriya Dash.