Greetings...

It is a little early in the morning, so maybe I am misreading this, but how
are you capturing the results from your rsh when you are redirecting the
output to a file on the remote system?  Those are backticks not single
quotes, right?  Not quite warmed up enough to actually test the code myself,
so...

Also, I am not a frequent rsh user, but the line syntax seems odd to me?
    `$rsh $_;hostid;>>results.file`

My interpretation of the above would be:
        1. Create remote connection
        2. When remote connection ends, execute hostid command on local
machine
        3. Create an empty file called results.file

I would think you wanted `/usr/bin/rsh $_ hostid`;

Have fun,
Jeremy

-----Original Message-----
From: Dame, Jared M (SAIC) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 4:55 PM
To: '[EMAIL PROTECTED]'
Subject: [Perl-unix-users] RSH Help


Need help figuring out what is wrong with a simple script that I just wrote.
I am trying to get a handle on a network that I just became in charge of
that has no documentation, now I have a large list of hostnames that I am
trying to get the complemented hostid's for but am having some issues
getting Perl to run a command. Line Eighteen is the problem line, where I am
trying to loop my rsh command to each entry in the hostfile that I have and
retain information regarding the hosted and place that into a file. DZEditor
is stating that my syntax is proper but that still does not tell me much as
to why this is not working. Any help would be grateful. OS is Solaris 7 &
IRIX.
 
#!/usr/bin/perl -w
#Reads in a list of hostnames and then using rsh goes out
#to the network and finds there hostid's
#
#Jared Dame 11-27-01

open (FILE, "/var/list") or die "can't open list file:$!";
open (OUTPUT, "/usr/bin/rsh") or die "RSH not Found:$!"; #path

while ($_ = <FILE>)
{
 next if /^#/; #Skips commented out lines
 next if /^$/; #Skips empty lines
 s/\s*#//;    #deletes comments
 s/\s*$//;    #deletes white space
 $rsh = <OUTPUT>;

 $results = '$rsh $_;hostid;>>results.file'; #This just prints out what is
contained in ''
 print "$results\n"; #I am only using this to see what is being done at run
time.

}
Thanks,
 
Jared M. Dame
Field Engineer
SAIC
 
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to