1

Return variable value from a script running in background

view story
linux-howto

http://www.unix.com – I have a script which runs a script in the background. Now the script running in background returns some variable value and i want to catch return value in the parent script. e.g. Parent Script : Code: #!/bin/bash ./Back.sh & pid=$! echo "a=$a" echo "b=$b" echo "d=$((a+b))" wait $pid Child Script run in background Code: a=4 b=5 c=6 Now when i run ./BackGroundProcess.sh , expected output is : a=4 b=5 d=9 what i get is a= b= d=0 Any suggestions or approach how I can retrieve a variable value from a script running in backg (HowTos)