Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6077941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:46:39+00:00 2026-05-23T10:46:39+00:00

Writing a simple bash script to do some checks for me in the morning:

  • 0

Writing a simple bash script to do some checks for me in the morning:
One part is pulling down some html files and making sure that they exist.
The other part is ensuring some local files are present, and emailing if they are not.
The problem I am facing is that I am receiving a “syntax error: unexpected end of file” and I can’t really understand why it i occuring.
Here is a simplified version of the code:

for myHost in $HOSTS
do
  result=$(wget -T $TIMEOUT -t 1 $myHost -O /dev/null -o /dev/stdout)
  result2=$(echo $result | grep "awaiting response")
  connected=$(echo $result | grep "404");
  if [ "$connected" != "" ]; then
    for myEMAIL in $EMAIL
    do
      echo -e "$(date) - $myHost is down! \n This is an automated message." | mailx -r "box.email.com"  -s "$SUBJECT" $myEMAIL
    done
  fi
done

numoffiles=`find . -maxdepth 1 -mtime -1 | grep -i .html | wc -l`
if [ "$numoffiles" -ne 5 ]; then
  FILE=$(find . -maxdepth 1 -mtime -1 -print| grep -i .html)
  mailx -r "box.email.com"  -s "FILE MISSIN" "$EMAIL" << EOF
  EOF
fi

from using sh -x I can see that it gets to assigning the number of reports to the var “numoffiles”, but then it just believes that is the end of the file. has anyone got any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:46:40+00:00Added an answer on May 23, 2026 at 10:46 am

    There should not be any space before the end of heredoc label:

       EOF
    ^^^
    

    Change it to

    EOF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a simple unix shell script: #!/bin/bash # abort the script if
I'm writing a bash script that needs to parse html that includes special characters
I am writing a very simple Bash script that tars a given directory, encrypts
I'm a bash newbie and am having trouble writing a simple script to see
I am writing a very simple comparison in shell bash script, but I never
I am writing a simple unix script as follows: #!/bin/bash mkdir tmp/temp1 cd tmp/temp1
I'm writing a very simple script to control a process, script checks if the
I am writing a simple Bash script to detect when a folder has been
I'm looking into writing simple graphics code in Android and I've noticed some synchronized()
I'm writing a bash script that needs to loop over the arguments passed into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.