Home > Syntax Error > Bash Script Syntax Error Near Unexpected Token Do

Bash Script Syntax Error Near Unexpected Token Do

Contents

done instead of Code: while read line do ... Unix & Linux Stack Exchange works best with JavaScript enabled current community chat Unix & Linux Unix & Linux Meta your communities Sign up or log in to customize your list. Last edited by tommylovell; 08-15-2011 at 07:56 AM. Symbolic comparison of recursive functions Meaning of Guns and ghee more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info mobile http://onlinetvsoftware.net/syntax-error/bash-script-syntax-error-near-unexpected-token.php

How to deal with a really persuasive character? The Bourne and Korn shell found on Solaris allow unmatched quotes especially backticks for instance (while other shells are stricter on that). Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. How does Gandalf get informed of Bilbo's 111st birthday party?

Linux Syntax Error Near Unexpected Token Then'

Join them; it only takes a minute: Sign up syntax error near unexpected token `do' in bash script up vote 0 down vote favorite I have bash script which takes 3 Sign into your account, or create a new one, to start interacting. This is what's causing the error you see. Are you sure you want to replace the current answer with this one?

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 What does the "Phi" sign stand for in musical notation? isn't it ? –Rahul Patil Jan 2 '13 at 12:34 It depends a lot on the user's environment. Syntax Error Near Unexpected Token Do R up vote 0 down vote favorite I keep getting this error: ./install.sh ./install.sh: line 28: syntax error near unexpected token `do' ./install.sh: line 28: ` do' When running this code (a

Tips like this are very helpful as I really want to improve my bash scripting knowledge. Why are some programming languages Turing complete but lack some abilities of other languages? How to deal with a really persuasive character? This site is not affiliated with Linus Torvalds or The Open Group in any way.

Force Microsoft Word to NEVER auto-capitalize the name of my company A simple visual puzzle to die for Why are some programming languages Turing complete but lack some abilities of other Syntax Error Unexpected Do You are currently viewing LQ as a guest. In terms of a suggested style, make your variables upper case ("for a in 10 20..." would be "for A in 10 20..."; and "cp ./a$a/b$b/..." and "...heatFluxGather $a $b" would Here's what I don't get though: somewhere else in my code, I have a similar compound command, but it's not inside a for loop.

Linux Syntax Error Near Unexpected Token Newline'

Next, the way you're replacing the file's extension won't work right. My response is for Linux, but in general I think some of it should apply. Linux Syntax Error Near Unexpected Token Then' A simple visual puzzle to die for Natural construction Is this safe to display MySQL query error in webpage if something went wrong? Syntax Error Near Unexpected Token Do For Loop Problem with using pause and onslide in one frame Integral using residue theorem complex analysis Skipping directly to level 4 Is there a good way to get from Levoča to Lviv?

How to map and sum a list fast? http://onlinetvsoftware.net/syntax-error/bash-for-loop-syntax-error-near-unexpected-token.php Is there a way to make a metal sword resistant to lava? Not the answer you're looking for? Meaning of Guns and ghee Unexpected parent process id in output How's the CMD trip bonuses from extra legs work? Syntax Error Near Unexpected Token Do Mac

You should be able to see if something is not terminated. Unix & Linux Stack Exchange works best with JavaScript enabled Share Twitter Facebook Google+ Hacker News Share your Question Your question has been posted! It does make finding syntax errors easier though... his comment is here See http://stackoverflow.com/questions/2...ad-interpreter If that's the case you can try dos2unix or mac2unix to fix the script file, although they not be available on your flavor of Unix.

For a root user on a Linux system with internet access and a decent package manager, switching to vim is probably easy (if they can operate a vi-like editor)... Syntax Error Near Unexpected Token In Shell Script asked 2 years ago viewed 5645 times active 2 years ago Related 1/shell-script: syntax error near unexpected token `done'2command not found and syntax error near unexpected token2bash: syntax error near unexpected Which requires more energy: walking 1 km or cycling 1 km at the same speed?

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

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 Feb 24 at 6:27 CodeGnome 2,8461619 1 Ahh, that makes sense now! 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. Unexpected End Of File Bash Realism of a setting with several sapient anthropomorphic animal species Does mean=mode imply a symmetric distribution?

Reply Log In to Comment 0 dinhhoangviet May 18, 2014 I copied and created new file with the code in example of the link: #!/bin/bash COUNTER=0 while [ $COUNTER -lt 10 Why are some programming languages Turing complete but lack some abilities of other languages? if conditionals end with then (either on the next line, or after a ;) not { You could fix it like this: if [ \( "${file: -4}" = "$1" \) -o http://onlinetvsoftware.net/syntax-error/bash-for-syntax-error-near-unexpected-token.php Why write an entire bash script in functions?

Will the medium be able to last 100 years? How to pluralize "State of the Union" without an additional noun? asked 3 years ago viewed 9434 times active 2 years ago Related 4Shell Script - syntax error near unexpected token `else'2command not found and syntax error near unexpected token2bash: syntax error change: Code: if [ $key = "RUNNING" ]; then to Code: if [ "$key" = 'RUNNING' ]; then vgersh99 View Public Profile Find all posts by vgersh99

Were slings used for throwing hand grenades? Are you new to LinuxQuestions.org? sjsam's advice to use shellcheck is good, but the short version is that you should be using square brackets instead of round ones on the internal brackets of your if statement: you should mention what Unix you are running.

How to book a flight if my passport doesn't state my gender? What are the canonical white spaces? what is the difference between \twocolumn and \documentclass[twocolumn]{book} Train ride from Copenhagen to Malmo How could banks with multiple branches work in a world without quick communication? Not the answer you're looking for?

Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ