Keeping same session/channel between distinc commands execution

Mar 30, 2013 at 6:03 PM

I would like to run two related commands. For instance:
  1. cd /
  2. dir
I saw that each RunCommand call resets the SSH session so the second command won't have the same session as the first one.

Is it possible to keep the session/channel open, so two commands will be executed within the same session?

Apr 2, 2013 at 12:54 AM

I am afraid it it is not possible due to server implementation.

One command execution cannot remember command execution results.
You can either execute one long command, which could be series of semicolon separated commands or look into using shell.

Hope it helps,

Apr 2, 2013 at 2:24 PM
You can do this with shell, as long as you seperate the commands with a ";" (in unix anyways)
ex: I do this all the time with my code
cd <somedir>;grep stuff <filename>