bash的EOF的if语句 [英] bash EOF in if statement
本文介绍了bash的EOF的if语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图做在一个猛砸ELSE IF语句中的动作,但收到错误像这样的:
I am trying to do an action in a IF ELSE statement in Bash, but receive an error like this one:
语法错误:文件意外结束(预计网络连接)
现在我很新的这一点,所以可能是解决我的问题不应该是困难的:)
Now I am quite new to this, so probably the solution to my problem should not be that difficult :)
if [ "$DAYNAME" = 'Sunday' ]; then
echo 'The backup will be uploaded'
ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
put $filetoday
delete ${filethreeweeksago}
quit
EOF
fi
当然的瓦尔已经填写。
Of course the vars are already filled.
我觉得它做的EOF符号,因为当我删除它们,这个问题在前看不见。不幸的是,我不知道如何使用code没有EOF符号。
I think it has to do with the EOF notation, because when i remove them, the problem disapears. Unfortunatly I don't know how to use the code without the EOF notation.
谁能告诉我为什么这个错误是高达正在添加?
Can anyone tell me why this error is comming up?
推荐答案
删除空白,它应该工作:
Drop the blanks and it should work:
EOF
^^^^
这篇关于bash的EOF的if语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文