Re: foreach loop problems

2002-02-13 Thread dan radom
I've set SSH_AUTH_SOCK and SSH_AGENT_PID environment variables so the script can run from cron, but there is no password prompt with ssh-agent and hostkey authentication. an * Johnathan Kupferer ([EMAIL PROTECTED]) wrote: > I was actually surprised to see that ssh worked like this! I don't >

Re: foreach loop problems

2002-02-13 Thread James Taylor
Ha, Ok well that was interesting. I ran this script on a different machine and it works fine... Weird. So, nevermind :) On Wednesday 13 February 2002 03:35 pm, you wrote: > I'm curious how you got this script to work, I re-wrote his with something > like this: > > my @hosts = ("1.com", "2.com

Re: foreach loop problems

2002-02-13 Thread James Taylor
I'm curious how you got this script to work, I re-wrote his with something like this: my @hosts = ("1.com", "2.com", "3.com", "4.com"); foreach my $key (@hosts) { system("ssh -l @ARGV[0] $key"); } and it will SSH to 1.com ONLY. After the session with 1.com is ended, it doesn't continue on

Re: foreach loop problems

2002-02-13 Thread Johnathan Kupferer
I was actually surprised to see that ssh worked like this! I don't think you can always get away with it, but I just tested it out and was able to call up ssh for 4 different machines using a script similar to that one. I don't think all programs are going to be that nice. Can anyone explain

Re: foreach loop problems

2002-02-13 Thread Michael Kelly
On 2/13/02 2:44 PM, dan radom <[EMAIL PROTECTED]> wrote: > Hi, > > > I've got a problem with the following code... > > my @hosts=qw( lunar solar venus mars saturn pluto ); > > foreach (\@hosts) { > system("/usr/bin/ssh @hosts $ARGV[0]"); > } > > > > What I'm wanting to do is call foo.p

Re: foreach loop problems

2002-02-13 Thread James Taylor
I don't believe this is what he's asking - What the problem is in this code is that after the first instance of SSH runs, and then exits, it will not continue on to the next key in the array. I can't figure out why it won't do it, I don't generally write programs using system calls :) On Wed

Re: foreach loop problems

2002-02-13 Thread Johnathan Kupferer
# Create array @hosts... So far so good. my @hosts=qw( lunar solar venus mars saturn pluto ); # \@hosts creates a reference to @hosts. You just want @hosts. # # The way you've written it, the elements in @hosts will be # assigned to the special variable $_. This is all right, but # tends to ge