sharpssh

running a unix command to go to a directory using SharpSSH in C#


I was using SharpSSH to connect to unix using C#. When i was trying to run the below command ssh.RunCommand("cd /home/directory"); (Provided this is a valid path)

its not working. Some one please help me how to execute this command


Solution

  • Resolved by executing the command in the below manner cd /path/;grep policy# filename;

    just by executing cd /path/ the directory will not change and cursor wont stay in that directory, next time when you execute a separate command that command will execute in home directory only.

    So always combined the command with change directory command