Home > Syntax Error > Syntax Error Near Unexpected Token Done' While Loop

Syntax Error Near Unexpected Token Done' While Loop

Contents

asked 4 years ago viewed 15466 times active 4 years ago Related 0Syntax error near unexpected token `done'3syntax error near unexpected token `('3-bash: syntax error near unexpected token `)'1cygwin syntax error Is including the key as AAD actually dangerous? As fenerlitk said 'I am trying to learn shell scripting', I figured it made sense that s/he would want to see the loop in action. Who is spreading the rumour that Santa isn't real? http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-done-for-loop.html

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 & Linux Stack Exchange works best with JavaScript enabled UNIX & Linux Forums > Top Forums > Shell Programming and Scripting Member Name Remember Me? Browse other questions tagged bash shell-script newlines or ask your own question. An electronics company produces devices that work properly 95% of the time Why do the Avengers have bad radio discipline?

Syntax Error Near Unexpected Token Done In Shell Script

Understanding the grammar: «illis Evangelii nuntiandi praebens mandatum» Schengen visa to Norway to visit my wife refused An electronics company produces devices that work properly 95% of the time Bounce off Log In Sign Up Report a Bug Use this form to report bugs related to the Community Report a bug: Name Email Message UbuntuCommunityAsk!DeveloperDesignDiscourseHardwareInsightsJujuShopMore ›AppsHelpForumLaunchpadMAASCanonical current community chat Ask Ubuntu Ask Maybe some good Samaritan will try to help you. share|improve this answer edited Sep 26 '14 at 20:41 answered Jan 2 '13 at 12:29 peterph 18.4k13248 add a comment| up vote 1 down vote You need to use vim editor

An expensive jump with GCC 5.4.0 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 Bash syntax error near unexpected token `done' up vote -3 down vote favorite This file is written in bash. Removing brace from the left of dcases Why are terminal consoles still used? Syntax Error Near Unexpected Token Do Mac The Failing code snippet is as following: [...] while read line do insert_into_table="insert into isam_subrack_tbl (select neId, friendlyName, eqptHolderActualType from $line)" $MYSQL_HOME/bin/mysql --socket=/tmp/mysql.sock -u$MYSQL_USER -p$MYSQL_PWD --host $MYSQL_HOST -Demlplatform -e "$insert_into_table" done

Reply Log In to Comment Have another answer? What does file file.sh output? –Fredrik Pihl Aug 21 '13 at 21:20 2 What is the problem? Are there too few Supernova Remnants to support the Milky Way being billions of years old? Log In to Answer Copyright © 2016 DigitalOcean™ Inc.

You previously marked this answer as accepted. Only One String May Be Given When Deleting Without Squeezing Repeats 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! Network Connectivity" echo "3. Instead I reused the same code with semi-colon approach instead.

Syntax Error Near Unexpected Token Do For Loop

Not so much for a normal user on Solaris or a user on an embedded system with limited space... –Gert van den Berg Jan 2 '13 at 12:49 add a comment| Add a language to a polyglot How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? Syntax Error Near Unexpected Token Done In Shell Script When I run it I get this error: ./q: line 7: syntax error near unexpected token `done' ./q: line 7: `done '**strong text** The code is: nohup echo ELMAYET > /dev/null Bash Syntax Error Near Unexpected Token `do' Which is wrong in shell (and most other computer languages).

For example my initial code using the newline (which threw the same error as yours): Y=1 while test "$Y" -le "20" do echo "Number $Y" Y=$[Y+1] done And using code with this content What dice mechanic gives a bell curve distribution that narrows and increases mean as skill increases? Browse other questions tagged apt bash scripts or ask your own question. An expensive jump with GCC 5.4.0 How do I politely decline a research grant? Syntax Error Near Unexpected Token Done' Cygwin

Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... linux operating commands and unix operating commands While loop error: 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 Should a country name in a country selection list be the country's local name? http://allconverter.net/syntax-error/syntax-error-on-token-s-misplaced-construct-s-for-loop.html Why does Snoke not cover his face?

Binary to decimal converter Make text field readonly Letter of Recommendation Without Contact from the Student How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? Syntax Error Near Unexpected Token Do R An expensive jump with GCC 5.4.0 How to decrypt .lock files from ransomeware on Windows Unable to complete a task at work. This site is not affiliated with Linus Torvalds or The Open Group in any way.

The end of a script doesn't need to be marked in any special way; it's just the end of the file.

Try with only -x to see where it first stops to make sense. System Information" echo "5. Does it run but not work right? Syntax Error Near Unexpected Token ' In Shell Script Why is this the case?

Why are terminal consoles still used? 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... check over here Post the entire script using BB Codes in one block AND then output you're getting.

bash share|improve this question asked Aug 21 '13 at 21:06 user1837725 81117 1 Your code is correct and works for me using ubuntu. 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 First time EVER using BASH, need it for a simple infinite loop on something. Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart?

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 Processes" echo "4. 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 true as jack suggested, or < /dev/null which is a bit lighter.

Registered Users" echo "2. How many times do you need to beat mom and Satan etc to 100% the game? That character gets interpreted as a character. 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

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 This is symptomatic of unexpected CR characters in the text file. share|improve this answer answered Mar 9 '15 at 19:58 Keith Thompson 150k20201355 ok that good for right but i think the code must give me a result in final.txt I imagine very few shells in use today would spawn a new process. –William Pursell May 10 '12 at 15:36 add a comment| up vote 1 down vote You could replace