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
According to the Bash manual here,
If a command is terminated by the control operator ‘&’, the shell executes the command asynchronously in a subshell.
And since a process run in a subshell cannot modify the environment of the parent shell, I guess what you are trying to do is only possible via temp files / named pipes. Or you could rethink your approach.