develooper Front page | perl.beginners | Postings from February 2002

using ssh within a perl program

Thread Next
From:
Leon, Yanet I,,DMDCWEST
Date:
February 26, 2002 10:40
Subject:
using ssh within a perl program
Message ID:
FCB24E4DD0BDD411857600805FC78FF734A588@ddsmttayz064.int.dmdc.osd.mil

I have been trying to create a module to ssh among different systems and
edit and create different files once I log in the remote system.  I want to
ssh into a remote system from system A create and edit different files on
the remote system after a successful ssh login.  My subroutines to edit and
create the files work great but I cannot ssh into the remote system.  How
can I accomplish this (ssh to a remote system) using perl?



	-----Original Message-----
	From:	gkhgkh@attbi.com [SMTP:gkhgkh@attbi.com]
	Sent:	Tuesday, February 26, 2002 10:24 AM
	To:	beginners@perl.org
	Subject:	Minor issues with format()

	I see what is happening, I think:  I am writing to a 
	separate file each time through the loop and format 
	doesn't know that each time through is a different page, 
	I think.  Any pointers on how to tell format to print 
	the header at the start of each new file would be 
	greatly appreciated.

	Thanks for your help.

	 
	> The only problem I have with the following script is it 
	> does not print the header information on the first 
	> page.  I must have missed something.  
	> 
	> I would appreciate any comments/suggestions.
	> 
	> Thanks
	> 
	> #!/usr/bin/perl -w
	> 
	> use strict;
	> 
	> use constant PATH 
	> => "/usr/local/scripts/security/sybase/user/";
	> use constant GROUPS => "group_files.doc";
	> use constant ACCESS => "user_access_all.doc";
	> 
	> my $user;
	> 
	> open F_GROUPS, PATH.GROUPS    or die "Can't open:  $!";
	> 
	> while (<F_GROUPS>) {
	>     chomp(my @field = split /:/);
	>     
	>     open OUT, ">$field[1]"  or die "Can't open:  $!";
	>     open F_ACCESS, PATH.ACCESS    or die "Can't open:  
	> $!";
	>     
	>     while (<F_ACCESS>) {
	>         chomp ();        
	>         $user = $_;        
	>         write OUT if (/$field[0]/);
	>     }
	>     
	> format OUT_TOP =
	> 
	> ||||||||||||||||||||Company Name||||||||||||||||||||||
	> ||||||||||||||||||||Report Title|||||||||||||||||||||||||
	> 
	> Security Group              First Name                
	> Last Name
	> ..
	> 
	> format OUT = 
	> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	> $user,
	> ..
	> 
	>     
	>         
	>     close OUT                   or die "Can't close:  
	> $!";
	>     close F_ACCESS              or die "Can't close:  
	> $!";
	> 
	> -- 
	> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
	> For additional commands, e-mail: beginners-help@perl.org
	> 

	-- 
	To unsubscribe, e-mail: beginners-unsubscribe@perl.org
	For additional commands, e-mail: beginners-help@perl.org

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About