The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
for loop not working - syntax error at line 6: `end of file' unexpected debojyoty Shell Programming and Scripting 3 04-13-2009 09:31 AM
for loop syntax trouble visitorQ Shell Programming and Scripting 9 04-13-2008 02:53 AM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
I got error like...syntax error on line 1, teletype koti_rama UNIX for Advanced & Expert Users 2 07-07-2007 07:35 PM
Syntax error.. livetaurean19 Shell Programming and Scripting 0 06-14-2005 04:23 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-18-2008
habzone2007 habzone2007 is offline
Registered User
  
 

Join Date: May 2008
Posts: 6
syntax error in while loop

Hi,

I have the following script (compile_mercury) and I get this error: I have no idea why...and I have written this script completely in linux (bash) and not in windows.

****************
./compile_mercury: line 136: syntax error near unexpected token `done'
./compile_mercury: line 136: `done'
****************

Here is the script. Line 136 is the second 'done' statement.

************
semi=2
while [ $semi -le 7 ]
semi2=0
while [ $semi2 -le 90 ]
e=1
while [ $e -le 12 ]
do
.....
....
e=`expr $e + 1`
done
semi2=`expr $semi2 + 10`
done
semi=`expr $semi + 1`
done
***************
Thanks
  #2 (permalink)  
Old 05-18-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Without seeing the whole script, it's very hard to say. It's not uncommon for this error message to be caused by a quoting problem somewhere pretty far from the line indicated by the error message; if a misplaced quote hides a "fi" from the shell, it will still be looking for it when it gets to a "done" much later, and complain about the "done". (You seem to be missing a "do" after "while [ $semi2 -le 90 ]"; perhaps this is related.)

I hope you have indentation in your actual script to show the structure, especially if it's that long. You might want to use code tags when posting code snippets in the future.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0