I am counting the no. of lines in a file as a background process (I need parallel execution)
counting="wc -l < abc.xyz" &
`$counting`
counting_process_id=$!
wait $counting_process_id
echo $counting
This just returns a blank for $counting
When I do,
counting="wc -l < abc.xyz"
`$counting`
echo $counting
i.e count in the foreground. It returns the proper value.
So I guess this has to do with child variable not accessible in parent shell ? (and some answers suggest IPC) Are ther other ways to get around this.