RunCommand() uses the ssh command feature. Means each command is started in it's own new "shell".
client.RunCommand("pwd")
=> $HOME
client.RunCommand("cd /tmp")
client.RunCommand("pwd")
=> $HOME
client.RunCommand("cd /tmp && pwd")
=> /tmp
I think what you need is a ShellStream.
Hint: Don't just check result, which is just STDOUT, also check the Error-Property.
client.RunCommand("pwd")
=> $HOME
client.RunCommand("cd /tmp")
client.RunCommand("pwd")
=> $HOME
client.RunCommand("cd /tmp && pwd")
=> /tmp
I think what you need is a ShellStream.
Hint: Don't just check result, which is just STDOUT, also check the Error-Property.