[JSch-users] Multiple commands using a ChannelExec?
Status: Alpha
Brought to you by:
ymnk
From: Andrzej T. <an...@ch...> - 2005-06-10 18:22:38
|
I've done an extended version of the Ant sshexec task which lets you nest multiple commands to be executed on the remote host. I keep the session open, but have been creating a new ChannelExec for each command submission. Problem with that is that your "environment" is not retained on the remote host between individual commands. For example, if I do two command, "cd .." and "ls -a" the directory is no longer set to the parent by the time the ls is executed. Is there a way to use a ChannelExec so that you can execute multiple commands, but not have it reset you back to the beginning regarding the "environment"...sort of like a normal telnet session? I'm thinking of something like not creating a new ChannelExec each time. Can you do a connect(), disconnect() and another connect() on the same channel to do this? Multiple connect() calls without an intervening disconnet()? Or something else? Or maybe I can't get there from here. I looked at the code for Channel, ChannelSession and ChannelExec, but it's pretty poor code, with zero comments, so on cursory inspection I'm not sure what it's doing. Any/all assistance would be very much appreciated! Thanks from a JSCH newbie. ....Andrzej Chaeron Corporation http://www.chaeron.com |