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

Syntax Error Near Unexpected Token Done Shell Script

Contents

true as jack suggested, or < /dev/null which is a bit lighter. for examples) as it really powerful and flexible aid in formatting the printing of your data. Try with only -x to see where it first stops to make sense. Amplifier circuit woe Schengen visa to Norway to visit my wife refused Remnants of the dual number Positivity of certain Fourier transform What is this strange biplane jet aircraft with tanks his comment is here

Not the answer you're looking for? Why is the Vitamin B complex, a "complex"? Modifying it to read while ${once}; do should fix it. Taking away one of the dones still gives me the same error. ./Present.sh: line 35: syntax error near unexpected token done' ./Present.sh: line 35: done ' –Dave Apr 11 '11 at

Syntax Error Near Unexpected Token Done' For Loop

In other words the while-do-done and if-then-else-fi clauses are overlapping. The end of a script doesn't need to be marked in any special way; it's just the end of the file. What statement does it belong to? –Etan Reisner Mar 9 '15 at 17:27 1 what about the other 20 lines? –glenn jackman Mar 9 '15 at 17:27 This

Why is bench pressing your bodyweight harder than doing a pushup? How many times do you need to beat mom and Satan etc to 100% the game? Removing brace from the left of dcases Display a Digital Clock VT-x is not available, but is enabled in BIOS Make text field readonly Idiomatic Expression that basically says "What's bad Bash Syntax Error Near Unexpected Token Do' 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?

You can also use cat -v test.sh if your cat command takes the -v parameter. Syntax Error Near Unexpected Token Do In Shell Script An expensive jump with GCC 5.4.0 Is an internal HDD with Ubuntu automatically bootable from an external USB case? How should I tell my employer? VT-x is not available, but is enabled in BIOS Why are terminal consoles still used?

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 Syntax Error Near Unexpected Token Done' Cygwin 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 measurable linear functionals are also continuous on separable Banach spaces? Browse other questions tagged shell unix loops syntax while-loop or ask your own question.

Syntax Error Near Unexpected Token Do In Shell Script

Complimenting the author of a textbook An electronics company produces devices that work properly 95% of the time Unable to understand the details of step-down voltage regulator Unable to complete a Join them; it only takes a minute: Sign up Syntax error near unexpected token `done' whis done written up vote 0 down vote favorite I have a problem with the done. Syntax Error Near Unexpected Token Done' For Loop Fenerlitk , note that the ':' no-op command could have been put in your loop, preceding you comment, i.e. : # do something, and that loop would have finished, but you While Loop Syntax Error Near Unexpected Token Done Please tell me what I am doing wrong. :-)a) [shimon]$ i=1; while [$i -lt 5] do; echo $i; i=$(($i+1)); donebash: syntax error near unexpected token `done'b) [shimon]$ while true do; echo

share|improve this answer answered Apr 15 '13 at 8:00 devnull 62.4k16103137 Yes!!! http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-do-shell.html Obvious but not see-able ... 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 done < $file Remove advertisements Sponsored Links jlliagre View Public Profile Find all posts by jlliagre

#5 04-27-2010 Lenora2009 Registered User Join Date: Syntax Error Near Unexpected Token Do For Loop

Remove the Windows line breaks with tr -d '\r' file.sh > fixedfile.sh share|improve this answer edited May 20 '15 at 17:51 answered Aug 22 '13 at 0:23 that other guy 46.5k54274 Forum Operations by The UNIX and Linux Forums Why does Snoke not cover his face? weblink 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

shell-script share|improve this question edited Jan 2 '13 at 13:14 mtk 4,413184483 asked Jan 2 '13 at 12:19 UNIX Learner 6112 1 some general comments: You probably want to quote Syntax Error Near Unexpected Token Do Mac Thank you that worked. :) –Jay Apr 15 '13 at 8:03 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign while read filename do echo "$filename" if [ -s $filename ] then tail -10 $filename | grep date '+%Y-%m-%d' >> $lastlines1 echo "- Next Error File - " >> $lastlines1 else

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

Member Posts: 449 bash "while" loop [SOLVED] « on: December 11, 2014, 03:02:00 PM » Hi,I am finally starting to learn bash scripting, and am having a problem with the 'while' Joining two lists with relational operators Why would Snape set his office password to 'Dumbledore'? 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 Syntax Error Done Unexpected 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.

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 This command made the script run correctly. –Murat Aug 24 '15 at 12:10 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Outlet w/3 neutrals, 3 hots, 1 ground? check over here Not the answer you're looking for?

How to reward good players, in order to teach other players by example How many times do you need to beat mom and Satan etc to 100% the game? 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. Do you have any idea about why I am getting this error in this while loop? Display a Digital Clock Is the partition function of non-conformal theories on a torus modular invariant?

Member Posts: 449 Re: bash "while" loop [SOLVED] « Reply #3 on: December 11, 2014, 04:23:31 PM » QuoteAlso, depending on the context you may want to use "return" or "break" share|improve this answer edited May 10 '12 at 16:32 answered May 10 '12 at 13:16 chepner 146k12127204 1 : is the correct no-op, but 'true' has been a builtin for Amplifier circuit woe Unable to complete a task at work. My code is: #!/bin/bash while : do echo "Press [CTRL+C] to stop.." sleep 1 done Saved it as .sh and ran bash file.sh CentOS 6 32-bit What is the issue?

Does it run but not work right? asked 5 years ago viewed 17568 times active 2 years ago Related 4576JavaScript function declaration syntax: var fn = function() {} vs function fn() {}1Shell syntax error near unexpected token `done' 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, What dice mechanic gives a bell curve distribution that narrows and increases mean as skill increases?

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)... Why is the Vitamin B complex, a "complex"? asked 1 year ago viewed 218 times active 1 year ago Linked 114 Remove carriage return in Unix Related 0Syntax error near unexpected token `done'0syntax error near unexpected token `}'10BASH Syntax Browse other questions tagged bash shell syntax for-loop syntax-error or ask your own question.

asked 3 years ago viewed 34975 times active 1 month ago Linked 1 Bash Syntax Error. 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 How can I stun or hold the whole party? How secure is a fingerprint sensor versus a standard password?

How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? 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 Hope the file for example with vim and enable the syntax check.