
branh0913
New User
Aug 29, 2012, 12:01 PM
Post #1 of 2
(661 views)
|
|
Passing arrays through command line args
|
Can't Post
|
|
Hello, I'm working on a project to test our ssh ability to connect, but I have literally hundreds of different profiles. I'm very new to perl, but I wanted to test this via a script (and get my feet wet). Basically for every one of my clusters I have a user profile, if the cluster is say c30, the I may have have something like 4 nodes in the c30 cluster. For example c30 may have a name like c30g1 c30g2, etc. so basically if I have a command line, it would be like this sshconntest -u c30g2 -s c30g2 I originally tried to assign array like so @nodeArray = (c30g1,c30g2); nodecount = 0 while (@nodeArray > scalar @nodeArray) nodecount++ commandtest = 'sshconntest -u $nodeArray[nodecount] -s nodeArray[nodecount]' printf $commandtest exit } This doesn't run, but in the past I've got this to work, it only grabs the first element in the array, and not the second one. Also in some cases like in the above example, it will say that nodecount is not numeric. I'm not sure how arrays work here, but is there anyway where I can pass an entire array into the commandline args? Any "best practices" when dealing with arrays that I should follow?
|