【发布时间】:2010-11-18 17:23:56
【问题描述】:
在下面的expect脚本中如何在expect脚本中获取rsync的退出状态
if [$? -eq 0] 抛出错误为
invalid command name "$?"
while executing
"$? -eq 0 "
invoked from within
"if [ $? -eq 0 ]"
(file "./tmp544.sh" line 7)
#!/usr/bin/expect -f
eval spawn ssh -l root 174.54.87.12 rsync /root/project /usr/project
expect "root@174.54.87.12's password: $"
send "\xxxxxxx\n"
expect "\\$ $"
if [ $? -eq 0 ]
then
echo "11"
else
echo "22"
fi
【问题讨论】: