2
我在下面的腳本中遇到了一些麻煩。從expect/tcl向perl腳本傳遞多個參數
proc checkUser {userip} {
set search "show users | include "
set search_cmd [concat $search $userip]
exp_send "$search_cmd\r"
expect {
-re "Vi.*" {
set oui "uei.opennms.org/services/passiveServiceStatus"
set host "localhost"
set iface "--interface $userip"
set service "--service Test"
set parm1 "--parm 'passiveNodeLabel [getNodeName $userip]'"
set parm2 "--parm 'passiveIpAddr $userip'"
set parm3 "--parm 'passiveServiceName Test'"
set parm4 "--parm 'passiveStatus Up'"
send_user [ exec perl /opt/opennms/bin/send-event.pl $oui,$host,$iface,$service,$parm1,$parm2,$parm3,$parm4 ]
#send_user [ exec [pwd]]
}
}
}
整個Expect腳本執行沒有錯誤,但是所謂的似乎並不當我與它做什麼,它該做的相同參數的bash運行perl腳本執行但Perl腳本。
這是從Expect中調用perl腳本的正確方法嗎?
在此先感謝。
工作就像一個魅力:)非常感謝Donal – SneakyMummin