RE: [Ssh-sftp-perl-users] Multiple operations in a single channel/shell? (Net::SSH)
Brought to you by:
dbrobins
|
From: Wildish, J. <Joe...@ca...> - 2004-12-13 11:00:25
|
I understood from the documentation that SSH 1 would create a new
connection each time, rather than channel (?). However, it could well be
me mis-reading it (I'm no SSH expert).
Anyway, you got me thinking; I was not specifying the protocol version
to use in the constructor. So, I tried specifiying "2", but the debug
output still indicates there are multiple channels in use. I then
remembered I didn't even compile in SSH1 support when I made the module,
so it must have been using 2 all along.
Incidently, I was getting this in the debug output:
<hostname>: Remote protocol version 2.0, remote software version 3.0.1
F-SECURE SSH
<hostname>: Net::SSH::Perl Version 1.25, protocol version 2.0.
<hostname>: No compat match: 3.0.1 F-SECURE SSH
I had a quick look through the code and it would seem F-Secure isn't
checked for. So I put an entry in to match it, with a mask of zero, but
the results were the same.
Any other ideas?
Thanks,
Joe
-----Original Message-----
From: ssh...@li...
[mailto:ssh...@li...] On Behalf Of
Mihai Secasiu
Sent: 12 December 2004 18:17
To: ssh...@li...
Subject: Re: [Ssh-sftp-perl-users] Multiple operations in a single
channel/shell? (Net::SSH)
you can execute multiple commands on the same channel if you use SSH 2=20
On Friday 10 December 2004 13:03, Wildish, Joe wrote:
> I originally thought that I could use Net::SSH::Perl to issue multiple
> commands in the same shell. However, having looked into it a little=20
> more, it seems that this is not the default behaviour. I have done a=20
> little research, and it appears that a seperate channel is created=20
> each time the cmd method is called - which effectively creates a new=20
> shell.
>
> I am wanting to execute the commands in the same shell. For example:
>
> ($out,$err,$rc) =3D $ssh->cmd("export FOO=3DWIBBLE");
> ($out2,$err2,$rc2) =3D $ssh->cmd("print $FOO");
>
> $out2 would equal "WIBBLE"....
>
> I think I can probably achieve this behaviour by registering a handler
> and iterating through each of the commands I want to issue within the=20
> subroutine, but this doesn't seem the nicest way. Ideally, if I could=20
> pass in the channel number to the cmd method, that would be cool... I=20
> am assuming of course that there are no problems with this approach?
>
> I was hoping people on this list may have come across this requirement
> before, and could perhaps point me in the right direction .... (?)
>
> Regards,
> Joe
--=20
+-----------------------------------------------------------------------
| Mihai Secasiu
| http://denixsolutions.com/
| Complete Unix/Linux Solutions for your Business
+-----------------------------------------------------------------------
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.=20
http://productguide.itmanagersjournal.com/
_______________________________________________
Ssh-sftp-perl-users mailing list
Ssh...@li...
https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users
|