我有这个脚本:
cd /tmp/
scp user@8.8.4.1:/onboot/OTA.sh /tmp -i /usr/script/id 2> /dev/null
if
chmod 775 /tmp/OTA.sh
/tmp/OTA.sh &
sleep 30
rm -rf /tmp/OTA.sh
fi
我想在脚本中告诉如果 scp
失败,尝试 wget
最佳答案
man scp
EXIT STATUS
The scp utility exits 0 on success, and >0 if an error occurs.
可以使用 bash 中的变量 $?
访问退出状态。
关于linux - 如何在脚本中告诉如果 scp 失败,请尝试 wget,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20514121/