歡迎您光臨本站 註冊首頁

expect

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

expect

我在使用expect  執行sed -i 的時候, 總是報錯無法執行, 請大家幫我分析下, 謝謝。具體的語句是這樣的,
expect "*#"
send "sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/sysconfig/selinux\r"
提示的錯誤是這樣的
send: spawn id exp6 not open
    while executing
"send "sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/sysconfig/selinux\r""
    (file "./test.exp" line 14)
請大家幫我看看謝謝
《解決方案》

"sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux\r"

這樣寫試試
《解決方案》

send "sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux\r"
sed命令格式不對 缺了單引號
《解決方案》

沒有spawn啊

[火星人 ] expect已經有367次圍觀

http://coctec.com/docs/service/show-post-476.html