請教各位先進
環境是centOS6.7
sudo yum install tcl和expect
裝好後寫好腳本 如果用user執行 $expect test.sh
可以正常執行
但若用$sudo expect test.sh 會執行失敗
腳本大概如下
spawn sshpass -p password ssh [email protected]
expect "xxxxx:"
send "sh\n"
expect "dddd"
send "yyy"
interact
會在執行到第三行的時候報錯 spawn id exp6 not open
請各位先進幫忙解惑 感激感激
--
All Comments