我尝试使用带有以下代码段的here-script将一些html文本打印到html文档。 $ file是sometext.html,每当我运行它时我都会收到错误:
line 126: warning: here-document at line 107 delimited by end-of-file (wanted _EOF_)
#!/bin/bash
echo << _EOF_
<html>
<head>
<title>
$TITLE $HOSTNAME
</title>
</head>
<body>
<h1>$TITLE</h1>
<p>$pTIME_STAMP</p>
$(system_info) <br>
$(show_uptime) <br>
$(drive_space) <br>
$(home_space) <br>
</body>
</html>
_EOF_
exit 0
编辑:我主要是从How can I write a here doc to a file in Bash script?
复制答案答案 0 :(得分:3)
确保之后之前_EOF_