Using coprocess to write a name referenced variable in BASH
0
votes
1
answer
436
views
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. $capture
is just empty. I would exspect it to be "ok".
Thanks a lot!
Asked by kon
(123 rep)
Jul 28, 2020, 12:52 PM
Last activity: Mar 20, 2025, 02:08 PM
Last activity: Mar 20, 2025, 02:08 PM