1
我正在编写一个小应用程序,通过SSH连接到服务器列表并执行一些命令。我正在使用jcabi-ssh。当运行该程序,jcabi-SSH输出到控制台系如:jcabi ssh将输出重定向到空或文件
[main] WARN com.jcabi.ssh.SSH - Permanently added '192.168.4.2' (RSA) to the list of known hosts.
[main] INFO com.jcabi.ssh.Execution$Default - $ ping -c 1 google.com
我的代码段如下:
Shell shell = new SSHByPassword(targetServer.toString(), Integer.parseInt(port), username.toString(), password.toString());
exitCode=shell.exec("ping -c 1 google.com",stdin,stdout,stderr);
我想或者隐藏控制台输出或重定向它到一个文件。我查看了source,但似乎无法通过方法调用完成。有没有办法做我想要的?
谢谢!