Hello, I've read a couple of posts and looked at a lot of different code examples, but I'm having issues. I would say mine is similar to this
post.
Pretty much I am trying to figure out how to extract output from after sendLine() command was sent. So if I send something like "df -h" I want the result of that command.
I'm not too familiar with matchers so if you have good documentation on it that would be greatly appreciated. I feel like this shouldn't be this hard so I apologize in advance,
but I've had no luck trying to play around with the matchers. The purpose of getting the output from the command is to store the results and able to use that elsewhere.
Some of my example code (I'm able to connect successfully):
Channel shell = session.openChannel("shell");
shell.connect();
// Using expect module
Expect expect = new ExpectBuilder()
.withInputs(shell.getInputStream())
.withOutput(shell.getOutputStream())
.withEchoOutput(System.out)
.withEchoInput(System.err)
.withExceptionOnFailure()
.build();
expect.sendLine("df -h");
String str = expect.expect(???)
System.out.println(str);