I am currently writing a script that is going to take a list of arguments (server names) from the command line. I want to pass this list of arguments to a function, which will then take each argument (given I don't know how many args there are) and pass that on to a different function. Without boring everyone with details, can anyone help me with the following. I have allready solved it using a different method, but being competitive in nature, I HAVE to figure out if it can be done.
What I want to try to do (unsolved)
i=1
while [ $i -le $# ]
do
Serv_Info $$i
i=`expr $i + 1`
done
The easy solution to the above (I know, just use the easy way but I wan't to get it working above)
while [ $# -ne 0 ]
do
Serv_Info $1
shift
done
An example is, if the first argument is "bob" then I want to call "Serv_Info bob". The first example just evaluates $$i to "$1" I have tried various ways of quoting, backslashing, single quoting and double quoting the Serv_Info $$i line with no luck. Any help would be great but like I said I have reverted to the easy way but I like knowing the hard way of doing something
