I have a global var foo=\"some value\" and a background process back_func, I want to the background process to access $foo and modify its value, which can be seen by the mai
If the main process (let's call it main.sh) is another periodically running bash script then you could simply have the the other script (let's call it other.sh) write the value to a file (let's call this file value.sh).
other.sh
#! /bin/bash
echo "SOME_VAR=42" > /tmp/value.sh
main.sh
#! /bin/bash
. /tmp/value.sh
# Now you can use SOME_VAR