I currently try to start background process with coproc and update a name reference variable. My not working code:
function updateVariable(){
local -n myVar="${1}"
#i=0;
while :
do
sleep 1
myVar="ok"
#((++i))
done
}
capture=""; coproc mycoproc { updateVariable capture; }
This does not work as I exspected. echo $capture is just empty. I would exspect it to be "ok".
Thanks a lot!