Home > Syntax Error > Syntax Error Near Unexpected Token Done

Syntax Error Near Unexpected Token Done

Contents

How should I tell my employer? If you have dos2unix on your box, you can use that command to fix your file: $ dos2unix test.sh share|improve this answer answered Aug 22 '13 at 0:41 David W. 71.5k16108232 How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? done < $file Remove advertisements Sponsored Links jlliagre View Public Profile Find all posts by jlliagre

#5 04-27-2010 Lenora2009 Registered User Join Date: navigate here

Good luck to all. –shellter May 10 '12 at 13:42 | show 1 more comment up vote 3 down vote dash and bash are a bit brain-dead in this case, they If you had edited/created this on a windows machine and copied to *nix, a 'dos2unix' will fix this. asked 4 years ago viewed 15466 times active 4 years ago Visit Chat Related 0Syntax error near unexpected token `done'3syntax error near unexpected token `('3-bash: syntax error near unexpected token `)'1cygwin Browse other questions tagged bash shell syntax for-loop syntax-error or ask your own question.

Syntax Error Near Unexpected Token Done In Shell Script

Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart? To answer a question, use the “Answer” field below. Which is wrong in shell (and most other computer languages).

Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart? Hope the file for example with vim and enable the syntax check. Resubmitting elsewhere without any key change when a paper is rejected Is an internal HDD with Ubuntu automatically bootable from an external USB case? Syntax Error Near Unexpected Token Done' Cygwin In fact, the ( ) may not be necessary –Random832 Apr 11 '11 at 3:01 it worked!!!!

Difficulties interpreting this complex sentence Lagrange multiplier on unit sphere Hit a curb today, taking a chunk out of the tire and some damage to the rim. While Loop Syntax Error Near Unexpected Token Done What mechanical effects would the common cold have? Display a Digital Clock Lagrange multiplier on unit sphere How to properly localize numbers? Are there too few Supernova Remnants to support the Milky Way being billions of years old?

What are the downsides to multi-classing? Syntax Error Near Unexpected Token Do Mac Rebus: Guess this movie How to reward good players, in order to teach other players by example Word for nemesis that does not refer to a person How to construct a measurable linear functionals are also continuous on separable Banach spaces? asked 5 years ago viewed 17568 times active 2 years ago Visit Chat Related 4576JavaScript function declaration syntax: var fn = function() {} vs function fn() {}1Shell syntax error near unexpected

While Loop Syntax Error Near Unexpected Token Done

Is the partition function of non-conformal theories on a torus modular invariant? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Syntax Error Near Unexpected Token Done In Shell Script You most likely have a carriage return or no-break space in your file. Syntax Error Near Unexpected Token Do For Loop This site is not affiliated with Linus Torvalds or The Open Group in any way.

I understood. Thanks again (but next time maybe be a bit more explicit in your warnings?) LOLOL You wrote the script ... check over here Does it not run at all? more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Bash Syntax Error Near Unexpected Token Do'

Browse other questions tagged shell unix loops syntax while-loop or ask your own question. Googling the error gives me a few responses from unix.com, but nothing of value (trying the suggestions of others who had these problems did not help the problem). Thanks so much for the help!!! http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-in.html errorCount=0 while read filename do echo "$filename" if [ -s $filename ] then tail -10 $filename | grep date '+%Y-%m-%d' >> $lastlines1 echo "- Next Error File - " >> $lastlines1

Grass grows through the floor of my building Bounce off the atmosphere at reentry? Syntax Error Near Unexpected Token Do In Unix done done There is a 'fi' missing, which makes the 'done' unexpected. Not the answer you're looking for?

Make text field readonly more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life /

You can't have an empty while do done block, (comments don't count) Try substituting echo $name instead #!/bin/bash names=(test test2 test3 test4) for name in ${names[@]} do printf "%s " $name How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? If you are trying to only echo no errors once if no files are found, you need to use a flag to indicate it. Only One String May Be Given When Deleting Without Squeezing Repeats Need a way for Earth not to detect an extrasolar civilization that has radio How do I politely decline a research grant?

Nov 2 '15 at 3:11 add a comment| up vote 2 down vote What is the error you're getting? $ bash file.sh test.sh: line 8: syntax error: unexpected end of file fi done ) share|improve this answer answered Apr 11 '11 at 2:55 Random832 18k22852 Hi Random832, Thanks for the suggestion. Still learning bash... –9a3eedi Oct 28 '15 at 7:00 @9a3eedi Can you post that whole compound command, where you get the syntax error? –chaos Oct 28 '15 at 7:19 weblink are shell scripts 'tab sensitive'?

Joining two lists with relational operators Make text field readonly more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed EDIT As mentioned elsewhere on this page : is a better choice of no-op. Schengen visa to Norway to visit my wife refused How to reward good players, in order to teach other players by example Is there any financial benefit to being paid bi-weekly

Good luck. –shellter May 10 '12 at 13:14 5 A valid "no-op" command is : –glenn jackman May 10 '12 at 13:37 1 @glennjackman : yes, good point. share|improve this answer edited Sep 16 at 18:24 Benjamin W. 8,743112244 answered Dec 15 '14 at 23:17 jak 234 If the newlines are the problem, you should probably dos2unix