I am trying to set a local variable in a function with nameref.
The script code is the following:
#!/usr/bin/bash
msg=hello
myparam=''
superfunc () {
productfile=$1
local -n refmyparam=$2
}
superfunc $msg $myparam
echo $myparam
When running it I get the error:
line 7: local: `': not a valid identifier
We use GNU bash, version 5.2.21