I have been trying to run the following script from the book Linux Command Line, but am getting an error unexpected end of file. I incrementally filled in each function and it seems like the issue is with the function report_home_space(). The script looks okay to me, though.
Any idea where the issue lies?
#!/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_