View Full Version : KSH help! passing variables to functions

12-04-2004, 10:18 PM
okay, I have the following code. (korn shell script in unix).

function abc
print $1

#main starts here

for((i=1; i<$#; i++))
abc $i
#end of program

#the $# variable is a count of the number of vars #passed to main from the command line.

#here, $i is the first command line variable. I want to #pass that variable to function abc. then i want the
#value of $2, then value of $3, etc.

when i do this, it actually passes $i rather than the value of $i. i have tried every type of syntax modification to the function call, but can't seem to make this work. any help would be GREATLY appreciated. thank you!