end of file problem with shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting end of file problem with shell script
# 1  
Old 10-20-2004
Error end of file problem with shell script

My shell script was working ok with K shell.
But all of sudden, it started acting crazy.
it keeps saying this:

syntax error at line 70 : `"' unmatched



I don't even have 70 lines in my file


or this :
syntax error at line 69: `end of file' unexpected



Can this file got corrupted somehow?
How do I fix it?
# 2  
Old 10-20-2004
Check for syntax errors on lines above the stated error - or it could even be at the begining of your script! A misplaced quote that isn't closed, a if statement that isn't closed. If you have a backup copy, check for differences between the two.
# 3  
Old 10-20-2004
MySQL Thank!!!

You are right.
I checked and found out somehow the begining two lines got merged ..



Thnks for the help!!!!!
# 4  
Old 10-20-2004
Well .That didn't fix the problem.

Here is my script:
Can someone help me find out what is wrong?


==================================
#! /bin/ksh

#CREATE A TMP DIRECTORY TO DUMP TMP FILES FROM THIS PROGRAM
if [ ! -d /tmp/breaktime ]
then
mkdir /tmp/breaktime
fi

#INITIALIZE VARIABLES

# GET INTERVIEWER LIST
/usr/ucb/echo "Enter interviewer numbers or leave blank for all interviewers"
/usr/ucb/echo -n "ENTER: "

read intvw

if [ -z "$intvw" ]
then

ls /mil1_usr1/time_logs/investigator > /tmp/breaktime/intvwtmp.$$
ls /mil2_usr1/time_logs/investigator >> /tmp/breaktime/intvwtmp.$$
ls /mil3_usr1/time_logs/investigator >> /tmp/breaktime/intvwtmp.$$
sort -u /tmp/breaktime/intvwtmp.$$ > /tmp/breaktime/list.$$
rm -f /tmp/breaktime/intvwtmp.$$


for i in `cat /tmp/breaktime/list.$$`
do

# GET ALL FILES
#EMPLOYEE# TIME TIMECLOCKCODE SHIFTTYPE EMPLOYEENAME

/usr/bin/cat /mil1_usr1/time_logs/investigator/$i /mil2_usr1/time_logs/investigator/$i /mil3_usr1/time_logs/investigator/$i >> /tmp/breaktime/time.$$ 2> /dev/null

done

/usr/bin/awk '{print $1,$6,$3,$7,$2}' /tmp/breaktime/time.$$ | /usr/bin/sort > /tmp/breaktime/tmp.$$

#GO THROUGH LOOP TO GET PAID BREAK TIME AND UNPAID BREAK TIME FOR EACH
#INTERVIEWER

while read rec
do

if [ "$intNewID" -eq "$intID" ] && [ -n "$intID" ]
then

intNewID=`/usr/ucb/expr substr "$rec" 1 4`
intNewStart=`/usr/ucb/expr substr "$rec" 6 10`
intNewCODE=`/usr/ucb/expr substr "$rec" 17 2`
intNewSHIFT=`/usr/ucb/expr substr "$rec" 20 1`

if [ "$intCODE" = "5" ]
then
intPaidBreak=`/usr/ucb/expr $intNewStart-$intStart`
echo "$intPaidBreak"
intTotalPaidBreak=`/usr/ucb/expr $intPaidBreak+$intTotalPaidBreak`
elif [ "$intCODE" = "54ektimereport.13273 ]
echo "$intTotalPaidBreak"
then
intUnpaidBreak=`/usr/ucb/expr $intNewStart-$intStart`
intTotalUnpaidBreak=`/usr/ucb/expr $intUnpaidBreak+$intTotalUnpaidBreak`
fi

else
#START READ IN A NEW ID RECORD

intID=`/usr/ucb/expr substr "$rec" 1 4`
intStart=`/usr/ucb/expr substr "$rec" 6 10`
intCODE=`/usr/ucb/expr substr "$rec" 17 2`
intSHIFT=`/usr/ucb/expr substr "$rec" 20 1`
# strNAME=`/usr/ucb/expr substr "$rec" 22 $len("$rec")`
strNAME=`/usr/ucb/expr substr "$rec" 22 20` /usr/ucb/echo "$intID" "$strNAME" "$intSHIFT" "$intTotalPaidBreak" "$intTotalUnpaidBreak" > /tmp/breaktime/breaktimereport.$$

fi
done < /tmp/breaktime/tmp.$$

fi
========================================
# 5  
Old 10-20-2004
In your elif ...

[ "$intCODE" = "54ektimereport.13273 ] <-- missing closing quote
# 6  
Old 10-20-2004
Bug problem solved!

RTM,
I don't know what to say.

THANK YOU VERY MUCH!

I guess from now on if I see this kind message again, I should just ignore it and check from the very begining of my file for every single little detail.

I don't like it! But thank you for all your help!!


Smilie


Smilie Smilie Smilie Smilie Smilie Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Spooling File to My Desktop From Back-end using shell script

Hello all, I am trying to spool a SQL query output file from back-end to desktop in a certain path but it didn't work,the query writes the output in a file in the same directory at the back-end. note : i use the same query in sql developper and file was created in the desired path fine code... (1 Reply)
Discussion started by: bmaksoud
1 Replies

2. Shell Programming and Scripting

help needed with shell script to append to the end of a specific line in a file on multiple servers

Hi Folks, I was given a task to append three IP's at the end of a specific (and unique) line within a file on multiple servers. I was not able to do that with the help of a script. All I could was: for i in server1 server2 server3 server4 do ssh $i done I know 'sed' could be used to... (5 Replies)
Discussion started by: momin
5 Replies

3. Shell Programming and Scripting

Problem with writing into a file through shell script

Hi all, I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below- #!/bin/bash while read line do connections=`echo $line | cut -d " " -f 1` period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies

4. Shell Programming and Scripting

Problem getting the content of a file in a shell script variable

Hi, I have a text file that has a long multi-line db2 CTE query. Now I want to store all the contents of this file (i.e. the entire query) in a shell script variable. I am trying to achieve it by this: query = `cat /Folder/SomeFile.txt` But when I echo the contents of this file by saying echo... (4 Replies)
Discussion started by: DushyantG
4 Replies

5. Solaris

gunzip problem! unexpected end of file

I've downloaded the tomcat from the link below and ftp to Solaris by ftp in binary mode Ref: Index of /dist/jakarta/tomcat-5/v5.0.30/bin gunzip -c jakarta-tomcat-5.0.30.tar.gz | tar -xvf - gunzip: jakarta-tomcat-5.0.30.tar.gz: unexpected end of file tar: read error: unexpected EOF ... (8 Replies)
Discussion started by: sbox
8 Replies

6. UNIX for Dummies Questions & Answers

Shell Script to end process help

I'm trying to write shell script that when invoke, has 2 arguements, or 1. If there's one arguement, then that's the process name. If there's 2, then one is the timeout. USAGE: Assign1.sh <process> <timeout> If no timeout was set, then the default timeout is 15 minutes. So after it read the... (6 Replies)
Discussion started by: NoobieBoobie
6 Replies

7. Shell Programming and Scripting

Help on shell script : syntax error at line 62: `end of file' unexpected

Hi All, I have written a korn script (code pasted below). It is giving the error while debugging "new.sh: syntax error at line 62: `end of file' unexpected". I have re-written the whole code in VI and explored all help related to this error on this Unix forum and tried it. Somehow, I could... (7 Replies)
Discussion started by: schandrakar1
7 Replies

8. Shell Programming and Scripting

File reading problem via shell script

Hi, Data file named parameter contains : DB=y Alter_def.sql Create_abc.sql SQL=y database.sql my_data.sql To read this file I use var_sql=$(awk -F= '$1 == "SQL" { print $2 }' parameter.txt) if then sql_f_name=`grep "\.sql" parameter.txt` echo $sql_f_name fi (2 Replies)
Discussion started by: Dip
2 Replies

9. Shell Programming and Scripting

Problem printing the property of xml file via shell script

Hi, I have a config.xml which cointains the tags like <CONFIG> <PROPERTY name="port" value="1111"/> <PROPERTY name="dbname" value="ABCDE"/> <PROPERTY name="connectstring" value="xyz/pwd"/> </CONFIG> This file is in some directory at UNix box. I need to write a... (4 Replies)
Discussion started by: neeto
4 Replies

10. Shell Programming and Scripting

Problem with Calling sql file from shell script

I have created abc.sh file which will set the environment variables (UNIX env variables as well as ORACLE required variables like ORACLE_SID,ORACLE_HOME etc) and then calls a function file which checks for starts some logs and then it will try to execute the .sql file. The .sh, function file are as... (1 Reply)
Discussion started by: sskc
1 Replies
Login or Register to Ask a Question