0
以下是我的代碼。請檢查如何通過Java中的JSch中的ChannelExec.setCommand()方法傳遞變量?
ChannelExec channelExec = (ChannelExec)session.openChannel("exec");
InputStream in = channelExec.getInputStream();
channelExec.setCommand("sh "+ "a.sh; echo \\$No");
a.sh
是我在Linux服務器上的shell腳本。我需要運行腳本以及值No
(作爲Java函數的參數接收)。
但是,No的值沒有傳遞給我的shell腳本。
請幫忙。
非常感謝。有效.. –