将两者混合在一起
var="hello"
function foo(){
local var="sup?"
echo "inside function, var=$var"
}
foo
echo "outside function, var=$var"
会输出
inside function, var=sup?
outside function, var=hello
var="hello"
function foo(){
local var="sup?"
echo "inside function, var=$var"
}
foo
echo "outside function, var=$var"
会输出
inside function, var=sup?
outside function, var=hello