gpt4 book ai didi

bash - 此处文档 - 意外的文件结尾

转载 作者:行者123 更新时间:2023-11-29 09:14:02 26 4
gpt4 key购买 nike

<分区>

我一直在尝试运行 Linux Command Line 一书中的以下脚本,但遇到意外的文件结尾错误。我逐渐填写了每个函数,问题似乎出在函数 report_home_space() 上。不过,剧本对我来说还不错。

知道问题出在哪里吗?

#!/bin/bash

# Program to output a system information page

declare -r TITLE="System Information Report for $HOSTNAME"
declare -r CURRENT_TIME=$(date)
declare -r TIMESTAMP="Generated $CURRENT_TIME, by $USER"

report_uptime(){
cat <<- _EOF_
<H2>System Uptime</H2>
<PRE>$(uptime)</PRE>
_EOF_
return
}

report_disk_space(){
cat <<- _EOF_
<H2>Disk Space Utilization</H2>
<PRE>$(df -h)</PRE>
_EOF_
return
}

report_home_space(){
cat <<- _EOF_
<H2>Home Space Utilization</H2>
<PRE>$(du -sh ~/*)</PRE>
_EOF_
return
}

cat << _EOF_
<HTML>
<HEAD>
<TITLE>$TITLE</TITLE>
</HEAD>
<BODY>
<H1>$TITLE</H1>
<P>$TIMESTAMP</P>
$(report_uptime)
$(report_disk_space)
$(report_home_space)
</BODY>
</HTML>
_EOF_

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com