I'm trying to get user input into a string variable and send it to my Linux server using ssh and C#. I'm using the ssh.net library and I want to pass the variable's value into a text file on the server, but I can't send it together with the echo command. Is there any other way to do it??
Here is the code :
using (var client = new SshClient(host, user, pass))
{
client.Connect();
string message = Console.ReadLine();
var mycommand = client.RunCommand("echo message >> file.txt");
client.Disconnect();
}