Hi,
I have a function in a ksh script to which I'm trying to pass a string as an argument. Like this:
Code:
function myFunct {
echo $1
}
VAR='this is a test string'
myFunct $VAR
The problem is that when I pass the variable $VAR to the function the argument is split into $1, $2, $3, $4, $5 which causes the "echo $1" to only print "this". This is not the case if I pass the string directly to the function, like this:
Code:
myFunct 'this is a test string'
This way "echo $1" prints the whole string.
How would I go about using the variable and get the function to treat it as one whole string? I've tried every qutoing way that I know of but can't get it to work.