2
我有以下期待腳本需要從expect腳本
expect -c "
spawn tdwallet add $StringName
expect \"^Enter\"
send \"Krishna123\r\"
"
if [ $? != 0 ]; then
echo "Failed to Add a String $StringName."
else
echo "\"add <string>\" ==> [OK]"
fi
我試圖修改expect腳本,即增加了一些行之後「送」
expect -c "
spawn tdwallet add $StringName
expect \"^Enter\"
send \"Krishna123\r\"
expect eof
catch wait reason
exit [lindex $reason 3]
"
但它是返回催生procees的退出代碼無論過程失敗/成功,總是返回一個非零值。
當你的程序失敗/成功時,你能給我一些指出正確退出代碼的指針嗎?
在此先感謝
問候,
Srikrishna地震署。