我在bash小片段bash脚本爆发循环不发送邮件
retries = 3
for ((i=0; i<retries; i++)); do
curl -1 --cipher ALL --connect-timeout 90 -T $zip_name ftps://ftp.box.com/Backup/$zip_name --user [email protected]:§fHyFSDF$o6
[[ $? -eq 0 ]] && break
echo "something went wrong, let's wait 6 seconds and retry"
sleep 6
done
[[ $retries -eq i ]] && { echo "This email is a notification of Failure" | mail -s "Failed" "[email protected]" ; exit 1; }
上述循环应重试3次,如果有做卷曲一个错误,所以如果卷曲错误出现这应该邮寄到电子邮件。但是,为了测试它我撤销用户的访问,所以我期望的电子邮件,但是这并没有工作,我收到以下控制台上:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
curl: (9) Server denied you to change to the given directory
为什么代码,如果访问,如果打破了第一次尝试撤销上传服务器
https://www.gnu.org/software/bash/manual/html_node/Quoting.html#Quoting – hek2mgl
@ hek2mgl你可以详细说明你想说的话? – Kittystone
我说你需要引用(a)变量和(b)包含特殊字符的字符串。我在代码中看不到引号。 – hek2mgl