Home > Syntax Error > Syntax Error Near Unexpected Token Done In Shell Script

Syntax Error Near Unexpected Token Done In Shell Script

Contents

Remove advertisements Sponsored Links jlliagre View Public Profile Find all posts by jlliagre #7 04-27-2010 mkukantha Registered User Join Date: Apr 2010 Last Activity: 18 February 2011, 2:53 Well, it is called !learning the hard way!" Logged Print Pages: [1] Go Up « previous next » PCLinuxOS-Forums » Help » General » bash "while" loop [SOLVED] SMF 2.0.11 Sep 16 at 18:26 add a comment| up vote 0 down vote There's a way you can get this problem without having mixed newline problems (at least, in my shell, which An alternative diagnosis is that the nested 'if' should actually be an 'elif': for var in bent bound bled bred brought built burned burnt bought caught clung \ crept dealt dug Source

share|improve this answer edited May 10 '12 at 22:31 answered May 10 '12 at 12:52 Thor 20.6k55078 2 I'd call not processing an empty loop a feature! ;-) Good luck Browse other questions tagged bash shell-script newlines or ask your own question. Re-writing, manually, the exact same code in the script just solved this. asked 1 year ago viewed 990 times active 1 year ago Related 1/shell-script: syntax error near unexpected token `done'2Bash : syntax error near unexpected token ' done '4syntax error near unexpected

Syntax Error Near Unexpected Token Done In Shell Script

Why is bench pressing your bodyweight harder than doing a pushup? Not the answer you're looking for? Idiomatic Expression that basically says "What's bad for you is good for me" What is this strange biplane jet aircraft with tanks between wings? Simple script Related 1bash - syntax error near unexpected token `<'0Bash: syntax error near unexpected token `else'2BASH: syntax error near unexpected token `done' with alias named 'do'1Bash syntax error near unexpected

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 Reply Log In to Comment Have another answer? Hope the file for example with vim and enable the syntax check. Syntax Error Near Unexpected Token Done' Cygwin See the examples in the link I gave you above.

Not the answer you're looking for? Most useful knowledge from the 30's to understand current state of computers & networking? How many times do you need to beat mom and Satan etc to 100% the game? Password Home Search Forums Register Forum RulesMan PagesUnix Commands Linux Commands FAQ Members Today's Posts Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh,

Share it with others to increase its visibility and to get it answered quickly. Syntax Error Near Unexpected Token Do Mac Please help. 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.

While Loop Syntax Error Near Unexpected Token Done

Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... unix and linux operating commands Syntax error near unexpected token Browse other questions tagged bash shell-script scripting or ask your own question. Syntax Error Near Unexpected Token Done In Shell Script 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 Syntax Error Near Unexpected Token Do For Loop Unable to complete a task at work.

If you had edited/created this on a windows machine and copied to *nix, a 'dos2unix' will fix this. http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-then-39-in-shell-script.html What do you do with all the bodies? In fact, the ( ) may not be necessary –Random832 Apr 11 '11 at 3:01 it worked!!!! I didn't notice the requirement for spaces around the brackets before.The rule of semicolon after condition (or maybe I should say before "do" and "then") seems to hold for everything: if, Bash Syntax Error Near Unexpected Token Do'

It does make finding syntax errors easier though... Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart? Join them; it only takes a minute: Sign up Syntax error near unexpected token 'done' up vote 2 down vote favorite I have been writing a unix script that will scan http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-shell-script.html cat -v will show them as ^M and M-BM- or M- respectively.

Is it still safe to drive? Syntax Error Near Unexpected Token Do In Unix bash shell syntax for-loop syntax-error share|improve this question asked May 10 '12 at 12:38 fenerlitk 72651634 add a comment| 5 Answers 5 active oldest votes up vote 3 down vote accepted It looks like evn after dos2unix you have CR line endings. –muru Aug 24 '15 at 7:22 1 @Murat, just like Stephane mentioned, the problem seems to be in the

share|improve this answer answered Apr 11 '11 at 2:52 ta.speot.is 19.4k63867 Hi taspeotis, thank you for looking at my question!

Can somebody help me ? Anyway, at a new terminal prompt I replaced 'exit' with 'return', and learned that:bash: return: can only `return' from a function or sourced script(I got out with ^c)So now my test 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 Only One String May Be Given When Deleting Without Squeezing Repeats How to decrypt .lock files from ransomeware on Windows Why does Davy Jones not want his heart around him?

Remnants of the dual number Need a way for Earth not to detect an extrasolar civilization that has radio How do I reassure myself that I am a worthy candidate for Should a country name in a country selection list be the country's local name? Join them; it only takes a minute: Sign up Confusing syntax error near unexpected token 'done' up vote 4 down vote favorite I am trying to learn shell scripting, so I Check This Out 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

UNIX is a registered trademark of The Open Group. Also, notice that you should quote your variables: wget --no-check-certificate --directory-prefix="${tempFolder}" "${i}" share|improve this answer edited Oct 28 '15 at 7:18 answered Oct 28 '15 at 6:54 chaos 28k65295 Is it still safe to drive? y/n; read yn; if [ $yn = y ]; then exit; fi; donespace after the opening square bracked and space before the closing square bracket.semicolon must be immediately after the while

Not the answer you're looking for? Feynman diagram and uncertainty Binary to decimal converter How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me even Do you have any idea about why I am getting this error in this while loop? Need a way for Earth not to detect an extrasolar civilization that has radio TV episode or movie where people on planet only live a hundred days and fall asleep at

more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation but why is your loop empty? –JaÍ¢ck May 10 '12 at 12:48 add a comment| up vote 1 down vote You need to have something in your loop otherwise bash complains. What mechanical effects would the common cold have? 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.

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 asked 3 years ago viewed 34974 times active 1 month ago Linked 1 Bash Syntax Error. A pilot's messages Why does MIT have a /8 IPv4 block? 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.

Community Tutorials Questions Projects Tags Newsletter RSS Distros & One-Click Apps Terms, Privacy, & Copyright Security Report a Bug Get Paid to Write Shop Almost there! My code is: for var in bent bound bled bred brought built burned burnt bought caught clung crept dealt dug dived dreamed dreamt fed felt fought found fled flung ground hung