我需要我的脚本从终端发送电子邮件.基于我在这里看到的以及许多其他地方的在线,我将它格式化为:
/var/mail -s "$SUBJECT" "$EMAIL" << EOF
Here's a line of my message!
And here's another line!
Last line of the message here!
EOF
Run Code Online (Sandbox Code Playgroud)
但是,当我运行这个时,我得到这个警告:
myfile.sh: line x: warning: here-document at line y delimited by end-of-file (wanted 'EOF')
myfile.sh: line x+1: syntax error: unexpected end of file
Run Code Online (Sandbox Code Playgroud)
...其中第x行是程序中最后写入的代码行,第y行是其中的行/var/mail.我试着更换EOF其他的事情(ENDOFMESSAGE,FINISH,等),但无济于事.我在网上找到的几乎所有内容都是这样做的,而且我真的很喜欢bash,所以我很难自己搞清楚.有人可以提供任何帮助吗?