Home > Syntax Error > Syntax Error Near Unexpected Token Do For Loop

Syntax Error Near Unexpected Token Do For Loop

Contents

Dealing with a nasty recruiter Does DFT produces the same output as FFT? It will similarly show any other strange characters you might have gotten into your file. Only got the error message when I separated the commands: $ sudo sh # ./install hope it helps share|improve this answer answered Nov 27 '15 at 22:00 user145114 1 command: dos2unix script_file.sh script_file.sh share|improve this answer edited Apr 24 '15 at 5:31 muru 18.7k33367 answered Apr 24 '15 at 5:26 M Sarfraz 1 add a comment| up vote -1 down navigate here

You are currently viewing LQ as a guest. Make up your mind. Sometimes some hidden characters are there in the source. So tried with command as : Code: $ dos2unix abc.sh dos2unix: converting file abc.sh to UNIX format ...

Syntax Error Near Unexpected Token Do For Loop

UNIX is a registered trademark of The Open Group. Encode the alphabet cipher What would have happened to the world if the sepoy mutiny of 1857 had suceeded? Use dos2unix or something similar to get rid of those. – devnull devnull is spot-on. Was running wrong arch executable.

  1. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
  2. I have my share of cases where the script complain at line 150 and the problem as on a misquote in a completed different line. –BitsOfNix Aug 24 '15 at 7:25
  3. To confirm its proper working you can also, check with different folder name to be present, e.g LOG_1.
  4. Not the answer you're looking for?
  5. It just means where the shell becomes aware of the problem, not necessarily where it is. –Fiximan Aug 24 '15 at 8:15 | show 5 more comments 1 Answer 1 active
  6. Run od -bc on your source file and paste the output in your question. –anubhava Aug 21 '13 at 21:37 @KeithThompson You're right that there is an error message
  7. 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
  8. How to create a torus with divided cuts that correspond to the direction of the torus Die Liebe höret nimmer auf Development of retrosynthesis plan Dozens of earthworms came on my

Is it dangerous to use default router admin passwords if only trusted users are allowed on the network? Does it not run at all? Does it run but not work right? Syntax Error Near Unexpected Token Done' While Loop What was the first operating system to feature a separate kernel?

I'd lose most of the extra blank lines you have inserted (probably for readability). Linux Syntax Error Near Unexpected Token Do UNIX is a registered trademark of The Open Group. Why does removing Iceweasel nuke GNOME? Hilbert-irreducible Banach space Does the reciprocal of a probability represent anything?

In other words the while-do-done and if-then-else-fi clauses are overlapping. Syntax Error Near Unexpected End Of File How to draw a clock-diagram? I see that you have run the file through dos2unix but I would still recommend you run it through something similar once more: tr -d '\015' < src.sh > dst.sh share|improve How could a language that uses a single word extremely often sustain itself?

Linux Syntax Error Near Unexpected Token Do

All rights reserved. http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected That character gets interpreted as a character. Syntax Error Near Unexpected Token Do For Loop Due to Ubuntu's DashAsBinSh affinity I suspect your script is interpreted by dash instead of bash. Syntax Error Near Unexpected Token Do Mac Development of retrosynthesis plan Can limit come into modulus of a given function?

I have yet to get the quitting part figured out completely, but before I can do that, I need to get past this do statement error. http://fullflash.net/syntax-error/syntax-error-unexpected-end-in-php.html Syntax error: unexpected “(”-3Shell script- syntax error: unexpected end of file9Unexpected EOF and syntax error0Syntax Error: unexpected end of file — Bash script-1Syntax Error: unexpected end of file — Bash script1C Above we don't see the PS4 (xtrace) output. –Stéphane Chazelas Aug 24 '15 at 7:06 2 What does file test.sh say? How much more than my mortgage should I charge for rent? Syntax Error Near Unexpected Token Do In Unix

This site is not affiliated with Linus Torvalds or The Open Group in any way. share|improve this answer edited Sep 16 at 18:24 Benjamin W. 8,518112043 answered Dec 15 '14 at 23:17 jak 234 If the newlines are the problem, you should probably dos2unix Minimum of a function on an open interval Can the editor of a book add citations of individual chapters to his own citation count? http://fullflash.net/syntax-error/syntax-error-near-unexpected-token-bash-function.html You currently have: *) do test -n '$folder' && echo You chose: $REPLY\) $folder && break; echo 'Wrong entry, try again.'; continue; done; ;; You are missing a for, while, or

This site is not affiliated with Linus Torvalds or The Open Group in any way. Syntax Error Near Unexpected Token Do R Note that all of the lines end with cr followed by a nl character. Why is the size of my email so much bigger than the size of its attached files?

share|improve this answer answered Feb 4 '14 at 5:36 santy 8610 add a comment| up vote 0 down vote I have exactly the same issue as above, and took me the

Why is this the case? Now when run this script install and sets up the environment without error but you have to enter your sudo password more than once due to sudo's time-out value by default. This is symptomatic of unexpected CR characters in the text file. Do Unexpected In Shell Script It was quite un-understandable at first, I think Word's hidden characters and/or formatting were the issue.

shell-script share|improve this question edited Jan 2 '13 at 13:14 mtk 4,265164383 asked Jan 2 '13 at 12:19 UNIX Learner 612 1 some general comments: You probably want to quote Does DFT produces the same output as FFT? Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ weblink I'm pretty new to this level of bash scripting ...

For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. Dealing with a nasty recruiter Player claims their wizard character knows everything (from books). Why is C# Dim a Chord in B Minor? asked 1 year ago viewed 3402 times active 1 year ago Related 1/shell-script: syntax error near unexpected token `done'2bash: syntax error near unexpected token `('-1Syntax error in bash script: near unexpected

How do we play with irregular attendance? How do I handle an unterminated wire behind my wall?