0

I'm trying to run this script below and I have no idea why its not working. I keep getting an error message that says "Syntax Error: Unexpected end of file" and I don't know how to trouble shoot this

#!/bin/bash

Add_Entry(){

        echo "Go Flight"
        pause
}

Delete_Entry(){

        echo "Go Flight"
        pause
}

View_Entry() {

        echo "Go Flight"
        pause

Show_menus() {

        echo "~~~~~~~~~~~~~~~~~~~~~"
        echo " M A I N - M E N U"
        echo "~~~~~~~~~~~~~~~~~~~~~"
        echo "1. Add Entry"
        echo "2. Delete Entry"
        echo "3. View Entry"
        echo "4. Exit"
}

Exit(){

        exit
}

Read_options(){

        echo "Please choose from the menu"
        read choice
        case $choice in
                1) Add_Entry ;;
                2) Delete_Entry ;;
                3) View_Entry ;;
                4) Exit ;;
        esac
}

# Main
while true
do

        Show_menus
        Read_options
done

The Add Entry, View Entry and Delete Entry are just full of dummy code at the moment. Still I have no idea why I'm getting this error. Any help would be most appreciated!

2

The View_Entry() block isn't closed. i.e. it should be

View_Entry() {

        echo "Go Flight"
        pause

}

Fixing this makes the script work for me. If you use a text editor with syntax hightlighting (e.g. vim or kate, perhaps gedit?) this is easy to spot.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.