flybonzai
flybonzai

Reputation: 3951

Shell: Unexpected End of File

I'm trying to find where I might have a mismatched tag or quotation, but it is eluding me. The error I am receiving is unexpected EOF at line 48, which only tells me what I already know. Here is my simple script:

#!/bin/bash

# Program to output a system information page

TITLE="System Information for $HOSTNAME"

CURRENT_TIMESTAMP=$(date +"%x %r %Z")
TIME_STAMP="Generated $CURRENT_TIMESTAMP, 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 /home/*)</PRE>
        _EOF_
    return
}

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

Upvotes: 1

Views: 66

Answers (1)

Richard E
Richard E

Reputation: 26

You're probably using spaces instead of tabs <<- doesn't work with with spaces.

Upvotes: 1

Related Questions