Export doesnt work for a back ground process
export START=100 . ./other.sh & wait
sleep 5 export END=200
but I dont see the variable END in "export -p". But I do see it if change the pipe.sh to
export START=100 . ./other.sh
how do I export variables from background process? Any work arounds?
A child process cannot change parents environment, you need to declare the variable from the parent somehow. For example using a file:
export START=100 . ./other.sh > tmp & wait source tmp rm tmp echo $END
sleep 5 echo "export END=200"