Z
Z
Zmtrk622020-02-05 11:26:03
linux
Zmtrk62, 2020-02-05 11:26:03

Is there a civilized way to get data from SSH in C#?

Good afternoon. There is a task to receive data in C# application from SSH. Those. for example, executing `rm /home/user/file.tar` to get the exit code of the operation (successful / unsuccessful). At the moment, it's just parsing the data given by the server. Maybe there is some more civilized way of such communication?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Official account of the Timeweb team, 2020-06-10
@timeweb_team

Answer from Timeweb support)
Initially, the rm command does not report the result. In this case, if the system used supports output, then you should use the rm -v command, if the output is not supported, then you can try redirecting the output to a file, for example:
rm -v /home/user/file.tar >command_input.txt 2 >&1
but there is also a question about whether this output is suitable for him, since he asks exactly what the execution code should be

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question