Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected end of file

Tags:

linux

unix

I've been asked to modify a bash script at my internship and since yesterday was the first time I started reading up on Bash syntax, I'm having a hard time figuring out a "syntax error: unexpected end of file" error. I was wondering if anyone would be able to help me out.

The last part of the script is:

    echo "  " >>${MAILLOG}

    echo "Building CSAPI SDK" >>${MAILLOG}
        cd ${BuildsDIR}
        make sdk
    # Wait 3 minutes for the HDXs to reboot and SDK build to complete
    echo "Waiting for the HDXs to reboot and SDK build to complete..." >>${MAILLOG}
        sleep 180
    echo "Running PyUnit tests" >>${MAILLOG}
        cd Common/csapi/pyunit
        make test >>${TESTLOG} 2>&1

    TestReportLink=`mklink ${BUILDURL}/${1}/build/Common/csapi/pyunit/report.xml`
    TestLogLink=`mklink ${BUILDURL}/${1}/build/${1}.test.log`

    echo "Test report: ${TestReportLink}" >>${MAILLOG} 
    echo "Test log: ${TestLogLink}"  >>${MAILLOG} 
    # Wait 3 minutes for the tests to complete
        sleep 180
like image 967
iman453 Avatar asked Nov 14 '25 10:11

iman453


1 Answers

On about line 129 of that script this appears:

    EOFBUILDFAILUREMSG

remove the leading white space from that line and your error message will go away.

That's the ending delimiter of a here document. You could leave in the leading white space if line 123 was changed to have the redirection operator as <<- and the white space consisted of only tabs (no spaces):

    cat <<-EOFBUILDFAILUREMSG >>${MAILLOG}
like image 159
Dennis Williamson Avatar answered Nov 17 '25 08:11

Dennis Williamson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!