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地震署。