On 24 November 2011 10:12, Agnello George <agnello.dso...@gmail.com> wrote:
> On Thu, Nov 24, 2011 at 12:09 PM, Charith LokuBogahawatta
> <charith...@gmail.com> wrote:
>> Hi All,
>>
>> I create following bash script to run some command on remote server
>> and get information but I try to do same using Perl but I couldn't
>> make it so any one can suggest way to get done this using perl ?
>>
>> my .sh...................................
>>
>> ssh -T $LOGIN <<EOI
>> cd /x02/oracle/downloads
>> find ./ -type d | sed -e 's/[^-][^\/]*\//--/g;s/--/ |-/'
>>>DirectoryStructure.txt
>> cat DirectoryStructure.txt
>> exit
>> EOI
>>
>> Here I'm getting directory structure of inside download folder also
>> appreciate if can give idea to create this same directory structure on
>> another remote machine using perl.Thanks for your help
>
> you could use the Net::SSH::Perl module
>
> my $ssh = Net::SSH::Perl->new($serverhost);
>    $ssh->login($user,$passwd);
>    my($output, $stderr, $exit) =  $ssh->cmd(" ls -la ");

There is also (the very new) Tak ( https://metacpan.org/module/Tak ), actually
it's so new the documentation isn't there yet, so maybe hold off for a few
months before considering it!

Leo

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to