【发布时间】:2011-08-13 23:39:42
【问题描述】:
我有下面的期望脚本
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 -c "
spawn tdwallet add $StringName
expect \"^Enter\"
send \"Krishna123\r\"
expect eof
catch wait reason
exit [lindex $reason 3]
"
但无论进程的失败/成功如何,它总是返回一个非零值。
当进程失败/成功时,您能否给我一些指示以识别正确的退出代码。
提前致谢
问候,
斯里克里希纳·埃拉。
【问题讨论】: