将文档重定向到此处,以文件结尾分隔



我正试图用带有以下代码段的here脚本将一些html文本打印到html文档中$文件是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

编辑:我主要是在复制《我如何用Bash脚本将here文档写入文件?》中的答案?

确保最后一个_EOF_

之前和之后没有空格

最新更新