Hi,
I am wondering if there is a way to do pass by reference in a bash
function. For example, I'd like `f` to do something like this. Is this
possible in bash? Thanks.
function f {
# do something to the variable referred by $1
}
declare x
f x
echo "$x" # x should have the value set by f.
function g {
declare x
f x # It should work for local variables as well.
echo "$x" # x should have the value set by f.
}
--
Regards,
Peng
[Prev in Thread]
Current Thread
[Next in Thread]
[Help-bash] Is there a way to pass by reference?,
Peng Yu<=