How to get result from background process linux shell script?
For example let's say I want to count the number of lines of 10 BIG files
under example directory.
for f in files
do
#this creates a background process for each file
wc -l $f | awk '{print $1}' &
done
I was trying something like:
for f in files
do
#this does not work :/
n=$( expr $(wc -l $f | awk '{print $1}') + $n ) &
done
echo $n
No comments:
Post a Comment