.bashrc.
var="xxx"
fun1(){
echo $var
}
export -f fun1
there was a problem calling the fun1 function in .bashrc from test.sh and could not get the value of var.
I rewrote
fun1(){
var="xxx"
echo $var
}
export -f fun1
you can call fun1 from test.sh.
there are two problems:
1.var= "xxx" needs to be called by other functions in .bashrc. Many people write a few more var= "xxx"
2.export-f fun1
if there are 10 functions that want to be called by other scripts from .bashrc, write 10 export-f funm?
how to solve these two problems properly?