help pls getting EOF error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help pls getting EOF error
# 1  
Old 04-23-2010
help pls getting EOF error

Code:
#!/bin/bash
while :
do
clear
echo ""***************************************"
echo  "*         - MAIN  -  MENU  -          *"
echo  "***************************************"
echo  "* 1.  Directory Listing               *"
echo  "* 2.  Users Currently Logged In       *"
echo  "* 3.  Create a Directory              *"
echo  "* 4.  View a man page                 *"
echo  "* 5.  View a web page                 *"
echo  "* X.  Exit                            *"
echo  "***************************************"
echo ""
echo -n "please enter option [1 - 5] "
read opt
clear
case $opt in
1) echo "++++++ Directory contents ++++++";
        echo"";
        ls -l;
        read enterkey;;
2) echo "++++++ Users currently logged in ++++++";
        echo"";
        read enterkey;;
3) echo "++++++ Create Directory ++++++";
        echo"";
        read enterkey;;
4) echo "++++++ Choose a man page to view ++++++";
        echo"";

5) echo "++++++ choose a web page to view ++++++";
         echo"";
         #read enterkey;;
X) echo "bye $USER";
         exit 1;;
*) echo "$opt is an invalid option, 1 - 5 only";
         read enterkey;;

esac
done

line 46: unexpected EOF while looking for matching `"'
and line 52: syntax error: unexpected end of file

Last edited by Franklin52; 04-23-2010 at 08:51 AM.. Reason: Please use code tags!
# 2  
Old 04-23-2010
This line (5) has an extra quote that knocks everything else out of place:

Code:
echo ""***************************************"

And the last line in case 5 is commented out, removing the ;;

And case 4 only has 1 ;

Last edited by Scott; 04-23-2010 at 09:33 AM..
# 3  
Old 04-23-2010
In addition to the "" issue, there is a ";;" missing in the case statement for option 4.
I've remove all excess trailing semi-colon characters to make it easier to read and put the ;; on a separate line. This is unix shell not Oracle and it is never necessary to end a line in a single semi-colon.

Code:
#!/bin/bash
while :
do
clear
echo "***************************************"
echo "* - MAIN - MENU - *"
echo "***************************************"
echo "* 1. Directory Listing *"
echo "* 2. Users Currently Logged In *"
echo "* 3. Create a Directory *"
echo "* 4. View a man page *"
echo "* 5. View a web page *"
echo "* X. Exit *" echo "***************************************"
echo "" echo -n "please enter option [1 - 5] "
read opt
clear
     case $opt in
     1) echo "++++++ Directory contents ++++++"
        echo""
        ls -l
        read enterkey
        ;;
     2) echo "++++++ Users currently logged in ++++++"
        echo""
        read enterkey
        ;;
     3) echo "++++++ Create Directory ++++++"
        echo""
        read enterkey
        ;;
     4) echo "++++++ Choose a man page to view ++++++"
        echo""
        ;;
     5) echo "++++++ choose a web page to view ++++++"
        echo""
        #read enterkey
        ;;
     X) echo "bye $USER"
        exit 1
        ;;
     *) echo "$opt is an invalid option, 1 - 5 only"
        read enterkey
        ;;
esac
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help to resolve unexpected EOF while looking for matching `"' error

Hi, can someone kindly look into my copy script and figure out why am i getting a "unexpected EOF while looking for matching `"' error message #!/bin/ksh -x cd /home/goldenga/test/flag37 if ; then rm copied.ok cd /home/goldenga/test Upper=`ls -t|grep 'qw*'|cut -d "w" -f 2|head... (4 Replies)
Discussion started by: NDalal007
4 Replies

2. Shell Programming and Scripting

Error with EOF when used in function

Hi all I am inserting record in oracle database using shell script. When the sql part is directly written in the shell script the record is getting inserted. But when the same piece of code is added into a function, I am getting an error while execution "line 45: syntax error: unexpected end of... (6 Replies)
Discussion started by: sudeep.id
6 Replies

3. Shell Programming and Scripting

EOF Usage - line 56: syntax error: unexpected end of file

Below is a test script I'm writing in the process of learning to write script. When I try to run it I get an unexpected end of file error on line 56. Thoughts? SCRIPT: #!/bin/bash # system_page - A script to produce a system information HTML file ##### Constants TITLE="My System... (1 Reply)
Discussion started by: mpercy725
1 Replies

4. UNIX for Advanced & Expert Users

tar: write error: unexpected EOF

tar: write error: unexpected EOF I usually encounter this when I'm doing backup to Dat72 tape. Here's the command gzip all files in a directory then tar cvfp /dev/rmt/0n files. Not all files are copied. Any things I should look at? Directory size? ---------- Post updated at 05:20 PM... (1 Reply)
Discussion started by: lhareigh890
1 Replies

5. Shell Programming and Scripting

[Solved] <<EOF error checking

I am trying to check the return status of a command thats encapsulated in an <<EOF #!/bin/ksh set -x xxx() { set -x ls -lt /tmp/jdlkewjdlkewjdlkewjdlewjdlew<<EOT ret=$? EOT echo "ret=$ret" } >>$LOG 2>&1 LOG=/tmp/t2.out rm -rf $LOG echo "Starting process `date... (2 Replies)
Discussion started by: BeefStu
2 Replies

6. UNIX for Dummies Questions & Answers

Unclosed EOF (error)

I have a script which throws an error: "here document `EOF' unclosed" The script is: ... main() { RETVAL=`sqlplus -s $ConnectDetails << EOF SET SERVEROUTPUT ON DECLARE errnum NUMBER; errmsg VARCHAR2(1000); BEGIN My_Procedure( errbuf => errmsg, errcode... (2 Replies)
Discussion started by: laiko
2 Replies

7. UNIX for Advanced & Expert Users

tar:read error: unexpected EOF

I need archive data from some tar files. I use the command "tar xvf filename". For about half of the files I get the error message "tar:read error: unexpected EOF". The number of bytes extracted comes very close to the size of the tar file. An example: 972434779 Jan 10 01:01... (4 Replies)
Discussion started by: mikeruth
4 Replies

8. Shell Programming and Scripting

Unexpected eof error

Hi, I am newbie and am just trying to connect to oracle from shell script ,,,but I am getting the following error ./prog.sh: line 20: syntax error: unexpected end of file The scripts is : #!/bin/bash O=$IFS; IFS=","; while read a b c d do echo $c ... (6 Replies)
Discussion started by: thana
6 Replies

9. UNIX for Dummies Questions & Answers

tar: write error: unexpected EOF

I am taring to disk and get this message: tar: write error: unexpected EOF This message is normally associated with tape devices, not disk. Here is the syntax: tar -cf <tarfilename> /dir Have you seen this message on disk tars? (4 Replies)
Discussion started by: jabe
4 Replies

10. Shell Programming and Scripting

tar: write error: unexpected EOF

Hi friends, I am using Sun Solaris 5.9. I want to take backup of 3 folders which are 50 GB in size totally using tar command on tapes. I am having DAT 72 tape. After initiating tar command (tar -cvf /dev/rmt/0n /tmp/dir1/ /tmp/dir2/ /tmp/dir3/), tarring is stopped after 10 hrs (approx) and i am... (7 Replies)
Discussion started by: vijayakumar.pc
7 Replies
Login or Register to Ask a Question