I don't know how to ask this question, the concept and my english are fuzzy.
I need to set some variables in a function, passing them by name, I read this before ask (I'm not shure if I understood all), the variables cannot be set, only read http://www.tldp.org/LDP/abs/html/ivr.html
The concept is
the result should be
Is there a way? Thank you all
I need to set some variables in a function, passing them by name, I read this before ask (I'm not shure if I understood all), the variables cannot be set, only read http://www.tldp.org/LDP/abs/html/ivr.html
The concept is
Code:
function VarsByRef ()
{
${$1}=100
${$2}=200
${$3}="some other text"
}
a=1
b=2
c="some text"
echo "Before 'VarsByRef'"
echo "a=$a"
echo "b=$b"
echo "c=$c"
VarsByRef a b c
echo "After 'VarsByRef'"
echo "a=$a"
echo "b=$b"
echo "c=$c"
the result should be
Code:
Before 'VarsByRef'
a=1
b=2
c=some text
After 'VarsByRef'
a=100
b=200
c=some other text
Is there a way? Thank you all