Paul
Paul

Reputation: 43

How do I fix unexpected end of file in bash script?

I had much luck last time I submitted a question so here goes: I am trying to debug a somewhat large BASH script when I get the following error:

./test.sh: line 418: unexpected EOF while looking for matching `"'
./test.sh: line 427: syntax error: unexpected end of file

The code below starts at line 400:

    echo "###########################################################"
    echo
;;
4)
    culebra_carriers
    get_month
    get_day
    logs_cdrs
    logs_wap
    get_mdn

    echo
    echo "###########################################################"
    echo
    echo "Searching for activity of $mobileNumber on $MON $DAY......."
    echo
    zgrep $mobileNumber $HOME/culebrapeak/$LOGCDR/$CULEB/$MON/$WAPLOG
    echo
    echo "###########################################################"
    echo
;;
esac
done
}

clear
main_menu

How do I make this error go away? It looks like I have the double quotes in all the right places... but this is only my 4th or 5th bash script... so please go easy on me.

Upvotes: 2

Views: 11541

Answers (2)

Anthony Rutledge
Anthony Rutledge

Reputation: 7564

A good way to solve problems like this is to use a text editor that highlights code between quotes. Short of that, if the "find" feature of your text editor gives a count too, you may be able to use it to quantitatively detect start/end character symmetry problems. The highlighting from the find feature will aide your eye tremedously.

Upvotes: 2

Paul
Paul

Reputation: 43

I was, indeed, missing a double quote at the top of my script. Thanks to all for the help!

Upvotes: 2

Related Questions