This is what I wannawant to achieve:
Function:
Func1() {
$1="Hello World"
}
Call function:
local var1
Func1 var1
echo $var1 (should echo Hello World)
I found this example which seems to work, but I guess using eval is not a good idea:
Func1() {
eval $1=$str1
}
How would be the correct way of doing this?
I'm coming from .Net and often use a parameter as a reference....i.e. For example, assigning a value back to the parameter which then can be used later on.
In the above example var1 should be assigned "Hello World"
(I'm using sh shell)