Sponsored Content
Top Forums Shell Programming and Scripting Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done' Post 302655285 by wolf@=NK on Wednesday 13th of June 2012 03:54:13 AM
Old 06-13-2012
pretty much I did the indentation and close the while-loops using the "\" forward slash However, I still get the same error?

Code:
[localuser@localhost ~]$ ./wk7.sh ./wk7.sh: line 37: syntax error near unexpected token `done' ./wk7.sh: line 37: `done'

and you mentioned I am missing do argument after the first and third line? may you correct or point out which line or where it is exactly since I've done some revisions yet still has an error...

Code:
1 #!/bin/bash #INSERT DO ARGUMENT HERE??? 2 3 #Read tabc.txt #INSERT DO ARGUMENT HERE??? 4 tabc="cat tabc.txt" 5 6 #Make week 7 assignment directory 7 wk7dir=~/"wk7dir" 8 9 #Prevents duplicates and errors 10 if [ ! -d $wk7dir ]; then 11 mkdir $wk7dir 12 fi 13 14 #Assign appropriate variables from tabc.txt 15 $tabc | sed -e 's/^\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\(.\{8\}\).*$/\3 \5 \6 \7 \8/' |\ 16 while read fileuser filesize filedate filename; 17 $tabc | sed -e 's/^\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\(.\{8\}\).*$/\7/' |\ 18 sed 's/://'|\ 19 while read filetime; do 20 21 #Change filesize 22 dd if=/dev/zero of=$wk7dir/$filename bs=$filesize count=1 23 24 #Create files based on date and filename 25 touch -d $filedate $wk7dir/$filename 26 27 #Changes file permissions to allow read, write, and execute to all users 28 find ~/"wk7dir" -type f -exec chmod 755 {} \; 29 30 ls -lR --time-style="+%Y%m%d" "wk7dir" |\ 31 sed -e 's/^\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\)/\6/' |\ 32 while read filedatestamp 33 34 #Modify file time 35 touch -mt $filedatestamp$filetime $wk7dir/$filename 36 37 done ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ :set number

---------- Post updated at 12:54 AM ---------- Previous update was at 12:48 AM ----------

Moreover, I am suspecting if I can have two while read statements?

the reason I have two is that I am trying to change field 7 "04:55" to not display or include the semi-colon...such a long hassle code but that's all I can think of to use sed strictly for this script the code I entered just to do that function is shown below:
Code:
sed -e 's/^\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\(.\{8\}\).*$/\7/' tabc.txt | sed 's/://' | while read filetime

 

10 More Discussions You Might Find Interesting

1. Solaris

syntax error at line 59: `end of file' unexpected

Hello... I'm trying to run the sshd script, but I keep geting the Syntax errot message . Here's the last few lines on the script. set nu in vi shows 58 lines, but I keep getting error referring to line 59. Any help is appreciated. Thanks, Remi else echo... (4 Replies)
Discussion started by: Remi
4 Replies

2. UNIX Desktop Questions & Answers

line 3: syntax error near unexpected token `('

Hi All I've used UNIX in the past experimenting with commands through terminal but thats about it. Im now currently teaching myself "C". Using a book from the library, the first chapter asks you run and compile your program from a command-line prompt. As you will see the program is very simple,... (4 Replies)
Discussion started by: camzio
4 Replies

3. 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

4. Shell Programming and Scripting

for loop not working - syntax error at line 6: `end of file' unexpected

I have a file called test.dat which contains a b I have written a shell script called test.sh for i in `cat test.dat` do echo $i done When i run this script using sh test.sh I get this message - test.sh: syntax error at line 6: `end of file' unexpected What is the... (3 Replies)
Discussion started by: debojyoty
3 Replies

5. Shell Programming and Scripting

syntax error at line 752: `end of file' unexpected

Hi, I'm having a syntax error at line 752: `end of file' unexpected. However, i didn't make any changes on line 752. I just inserted a new code in an existing program. Can anyone please check if there is something wrong with my code: if then lline=`tail -5 $badfile` ... (3 Replies)
Discussion started by: chryz
3 Replies

6. Shell Programming and Scripting

./TRUNCATE-PS_TXN.sh: line 54: syntax error: unexpected end of file

Hi All , My below script is for chacking vaule and then trucating table : ___________ test4@aceuatcs04:/u01/test4/SOLID/Testscript>cat TRUNCATE-PS_TXN.sh #-------------------------------------------------------------------- # Created by:Kaushlesh Yadav # Generated on: 15/07/2010 # Job... (4 Replies)
Discussion started by: kaushelsh168
4 Replies

7. Shell Programming and Scripting

line 15: syntax error: unexpected end of file

Hi all, I am very new to programming and even newer to this forum as well, so I apologize if this should have been in the Newbie category, but... I am currently trying to figure out Shell Scripting and am running into problems early. Not having taken any kind of programming class, I am not even... (2 Replies)
Discussion started by: ccorder22
2 Replies

8. Red Hat

sh: module: line 1: syntax error: unexpected end of file

Hi, We have installed linux6(RHEL) OS and installed datastage application on that. First time installation worked fine and our all services related to datastage was up and running. When we stopped the datastage and restarted its giving below error while restart:- ./uv -admin -start DataStage... (0 Replies)
Discussion started by: prasson_ibm
0 Replies

9. Shell Programming and Scripting

Del: line 13: syntax error: unexpected end of file

1 echo -e "Enter a filename" 2 read filename 3 if 4 then 5 echo -e "do you want to delete?" 6 read answer 7 if 8 then rm myfirst 9 else 10 echo -e "file not deleted" 11 fi 12 exit0 (1 Reply)
Discussion started by: Speedy
1 Replies

10. Programming

Sh: -c: line 0: syntax error near unexpected token `(' how to resolve this

Below query is not working for me. Please help me on this DATA EXCLUDE STATEMENT: TABLE:\"LIKE \'%\_HISTORY\'\", TABLE:\"LIKE \'%\_HIST\'\", TABLE:\"in \(select tname from tab where REGEXP_LIKE(TNAME,\'\_H$\'\))\", TABLE:\"LIKE \'%\_LOG\'\", TABLE:\"LIKE \'DW\_%\'\", TABLE:\"LIKE... (1 Reply)
Discussion started by: princy
1 Replies
All times are GMT -4. The time now is 02:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy