[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-10 11:03:45
|
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 more, it seems that this is not the default behaviour. I have done a little research, and it appears that a seperate channel is created each time the cmd method is called - which effectively creates a new 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 subroutine, but this doesn't seem the nicest way. Ideally, if I could pass in the channel number to the cmd method, that would be cool... I 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 |