tags:

views:

39

answers:

1

I'm using SharpSSH to connect to an SSH server and I've tried using both SshShell and SshExec. I need to be able to take a series of commands and send them to the server in order, so SshShell doesn't really do what I need since I would have to wrangle streams the whole time and it seems that it would be a bit of a kludge. So I've tried SshExec but found one problem with it, every time I send a command it seems to be making a new connection and losing the context of the last command. For example if I ran the following commands:

pwd
cd .ssh
pwd

I would expect it to output

/home/adam

/home/adam/.ssh

But, instead it just ouputs "/home/adam" both times, meaning that the directory change was lost in between.

Is there a way I can configure this so that it maintains a constant connection to the SSH server until I tell it to disconnect?

A: 

To cd to a hidden directory (any directory beginning with a dot (.) character), you need to enclose the value in quotes.

According to the documentation:

4) If the first component of the directory operand is dot or dot-dot, proceed to step 6.

6) Set curpath to the string formed by the concatenation of the value of PWD , a slash character, and the operand.

In short, cd '.ssh' should do the trick.

Chris Shouts
I mistyped, and that was just a example. The issue is still the same though... any example you want, the context does not persist.
Adam Haile