考慮:帶有標準輸入重定向的WinSCP ExecuteCommand?
var linuxCommmand = "/opt/ndmcli -x";
var linuxOptions = "sel stat pnum=157 detail=yes;\nquit;";
SSH.ExecuteCommand(String.Format("{0} <<!!\r\n{1}\r\n!!\r\n", linuxCommand, linuxOptions));
諮詢會話日誌顯示的命令是正確的,這一點:
2016-10-25 14:12:49.433 Script: call /opt/cdunix/ndm/bin/ndmcli -x <<!!
2016-10-25 14:12:49.433 sel stat pnum=157 detail=yes;
2016-10-25 14:12:49.433 quit;
2016-10-25 14:12:49.433 !!
2016-10-25 14:12:49.433 Executing user defined command.
2016-10-25 14:12:49.433 /opt/cdunix/ndm/bin/ndmcli -x <<!!
2016-10-25 14:12:49.433 sel stat pnum=157 detail=yes;
2016-10-25 14:12:49.433 quit;
2016-10-25 14:12:49.433 !! ; echo "WinSCP: this is end-of-file:$?"
2016-10-25 14:13:04.437 Waiting for data timed out, asking user what to do.
2016-10-25 14:13:04.437 Asking user:
2016-10-25 14:13:04.437 **Host is not communicating for 15 seconds.
2016-10-25 14:13:04.437
2016-10-25 14:13:04.437 Wait for another 15 seconds?**()
是否有任何理由我不能使用標準輸入重定向與WinSCPNet的ExecuteCommand
?
謝謝!
**** ****更新 古怪,如果我添加尾隨空格:
var linuxCommmand = "/opt/ndmcli -x";
var linuxOptions = "sel stat pnum=157 detail=yes;\nquit;";
SSH.ExecuteCommand(String.Format("{0} <<!!\r\n{1}\r\n!!\r\n ", linuxCommand, linuxOptions));
這一切工作正常:
2016-10-25 15:58:03.489 Script: call /opt/cdunix/ndm/bin/ndmcli -x <<!!
2016-10-25 15:58:03.489 sel stat pnum=157 detail=yes;
2016-10-25 15:58:03.489 quit;
2016-10-25 15:58:03.489 !!
2016-10-25 15:58:03.489
2016-10-25 15:58:03.489 Executing user defined command.
2016-10-25 15:58:03.489 /opt/cdunix/ndm/bin/ndmcli -x <<!!
2016-10-25 15:58:03.489 sel stat pnum=157 detail=yes;
2016-10-25 15:58:03.489 quit;
2016-10-25 15:58:03.489 !!
2016-10-25 15:58:03.489 ; echo "WinSCP: this is end-of-file:$?"
2016-10-25 15:58:03.550 Script:
2016-10-25 15:58:03.550 Script: **************************************************************
2016-10-25 15:58:03.550 **************************************************************
2016-10-25 15:58:03.550 Script: * *
2016-10-25 15:58:03.550 * *
2016-10-25 15:58:03.550 Script: * Licensed Materials - Property of IBM *
---- (log continues, and I get my expected output) ----
困惑...有沒有在這裏的一個問題一個問題嗎? – Darren
對不起,我的問題是在一開始,我會重新排列,使其更清晰。謝謝! – John
什麼是'ndmcli'?它有什麼作用?什麼是'sel'命令? –