Home > Unexpected Token > Syntax Error Near Unexpected Token (' Bash

Syntax Error Near Unexpected Token (' Bash

Contents

Unix & Linux Stack Exchange works best with JavaScript enabled www.jwgoerlich.us J Wolfgang Goerlich's thoughts on Information Security Home Blog Archive Contact Subscribe << Under all Unix flavors, a newline is represented by the character LF only. Join them; it only takes a minute: Sign up bash file returns unexpected token `$'do\r'' up vote 1 down vote favorite 1 I found this script over the next and tried Check out this answer for a variety of solutions using different tools. http://netlookmag.com/unexpected-token/syntax-error-near-unexpected-token-do-for-loop.html

Thanks! Help my maniacal wife decorate our christmas tree Aligning texts side by side with equations in \align environment Rebus: Guess this movie Secret salts; why do they slow down attacker more With no INPUT, or when INPUT is -, read standard input. This one worked for me.

Syntax Error Near Unexpected Token (' Bash

I already did this for you, but please remember it for the future. –slhck Oct 1 '11 at 18:31 | show 2 more comments 2 Answers 2 active oldest votes up I'm aware git is able to do newline conversion but I would not expect it on cygwin. –n611x007 Jun 10 '13 at 7:36 1 @naxa - Newlines were probably chosen share|improve this answer answered Sep 21 '15 at 17:37 user2548343 1668 add a comment| up vote 1 down vote Resolved with Notepad++ : 1) Menu->Edit->EOL Conversion -> Unix/OSX Format 2) Then So it must be set before your shell starts - therefore it must go into a Windows environment variable. –svec Dec 29 '14 at 14:52 2 it works for me

Thanks a lot! –kfirba Nov 27 '14 at 18:23 add a comment| Did you find this question interesting? desc()
{ Should be: function desc { Script example: #!/bin/bash function desc { echo Hi } echo Starting desc echo Ending share|improve this answer answered Oct 22 '13 at 21:23 tamarintech I think its because I'm on windows and using Cygwin. Bash Syntax Error Near Unexpected Token (' Ubuntu Remnants of the dual number default override of virtual destructor Add a language to a polyglot Amplifier circuit woe Change syntax of macro, to go inside braces Most useful knowledge from

I finally got the source checked out right, and I installed cygwin with no problems (I have used it in the past), but when I went to compile, I get this asked 5 years ago viewed 7028 times active 5 years ago Related 15Why did ; after & return an unexpected token error in bash?1Eval Error in Shell4dropboxd Syntax error: “)” unexpected0bash: default override of virtual destructor Is there any financial benefit to being paid bi-weekly over monthly? Browse other questions tagged bash shell-script cygwin or ask your own question.

Index Nav: [DateIndex] [SubjectIndex] [AuthorIndex] [ThreadIndex] Message Nav: [DatePrev][DateNext] [ThreadPrev][ThreadNext] Other format: [Raw text] Re: The /r error message while running a script? Syntax Error Near Unexpected Token Mac From: "Larry Hall (Cygwin)" To: cygwin at cygwin dot com Date: Tue, 27 Mar 2007 17:39:50 -0400 Subject: Re: The /r error message while running a asked 3 years ago viewed 2852 times active 7 months ago Visit Chat Related 2How to execute shell script in cygwin?2Run shell script on windows using Cygwin1Cygwin browser script error2Bad interpreter 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 Error Near Unexpected Token In Shell Script

There may be newline differences to consider too (In Windows environments, a carriage return and linefeed is often used to terminate lines in files, whilst in Linux and OSX, only a share|improve this answer answered Oct 6 '14 at 16:26 Azkuma 111 1 Welcome to U&L.SE –eyoung100 Oct 6 '14 at 16:32 add a comment| up vote 0 down vote The Syntax Error Near Unexpected Token (' Bash mkdir -p "$TARGET/$(dirname $i)" # Then copy over the file. Unexpected Token `$'\r'' Bash Bazos 8,61521734 THANK YOU!

To convert an existing file in place under Linux or Cygwin from Windows line endings to Unix line endings, you can use the following command. http://netlookmag.com/unexpected-token/unexpected-token-error-in-r.html Difficulties interpreting this complex sentence Is the partition function of non-conformal theories on a torus modular invariant? Unix? Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? Unexpected Token Error In R

Browse other questions tagged bash cygwin shell-script newlines or ask your own question. From: Larry Hall (Cygwin) Re: The /r error message while running a script? It was at the end of line 3 which is now the line 11 as you probably added the shebang sequence and comments later. have a peek here Will majority of population dismiss a video of fight between two supernatural beings?

References: <[email protected]> Reply-to: cygwin at cygwin dot com Kevin Markle wrote: Larry Hall (Cygwin) laid this down on his screen : Kevin Markle wrote: Hello, I'm attempting to write Install Dos2unix Cygwin You probably need to add #!/bin/bash if your script is executable –Anthon Oct 22 '13 at 21:24 1 The script is fine. 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

DESCRIPTION Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default size is 1000 lines, and default PREFIX is `x'.

Cygwin provides an easy tool to accomplish this. Some of it is add...Tip: Cygwin for Bzip2 (.bz2)I find the Windows shareware and nagware tools for Gzip and Bzip2 files lacking. If you can post the URL for the source download, I'll take a look at setup.exe. $' R' Command Not Found Cygwin This site is not affiliated with Linus Torvalds or The Open Group in any way.

bash -x -o igncr script.sh share|improve this answer answered Mar 18 '14 at 13:39 user1010997 17817 Thanks. Everything I put in hash-tag just a simple explanation to what I'm trying to do. –leepyron Jul 25 '13 at 7:29 @leepyron I do not completely understand your comment. This is the guide that I follow: n3cat.upc.edu/tools/UserGuide/UserGuide.html –leepyron Jul 26 '13 at 4:57 add a comment| up vote 0 down vote You are using bash features but using a sh http://netlookmag.com/unexpected-token/syntax-error-near-unexpected-token-newline-39-doctype-html-39.html Add a language to a polyglot 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

Difficulties interpreting this complex sentence Positivity of certain Fourier transform An expensive jump with GCC 5.4.0 Why are terminal consoles still used? current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. If you're not using Git, you simply need to convert these affected files/scripts back into Unix-like line endings (LF), either by: dos2unix ~/.bashrc Note: This command may corrupt your file, if Help my maniacal wife decorate our christmas tree Why do the Avengers have bad radio discipline?

The dos2unix.exe command will set all linefeeds to the single (\n) character. $ dos2unix.exe script.shdos2unix: converting file script.sh to Unix format ... Your installation of Cygwin expects only newlines. 'd2u' will convert the files from Windows to the expected format. Make text field readonly What mechanical effects would the common cold have? Windows and Windows editors rely upon the double return of the linefeed (\n or 0x0A or 10) plus the carriage return.

Browse other questions tagged bash shell cygwin newline or ask your own question. share|improve this answer answered Oct 1 '11 at 18:23 Daniel Beck♦ 80.7k9192252 add a comment| up vote 1 down vote Check the end line character in the file. It looks like setup.sh uses Windows-style line endings -- or at least line 94 does. Is it still safe to drive?

I was suspecting the \r but I couldn't make it disappear. s.path = "script.sh" end share|improve this answer edited Apr 27 at 21:01 answered Mar 8 at 16:24 kenorb 24.1k10165141 1 "git config --global core.autocrlf false" Helped. Since there is no such command, bash displays its usual error message. How to properly localize numbers?

measurable linear functionals are also continuous on separable Banach spaces? The dos2unix command modifies newline characters so they are Unix / Cygwin compatible. Join them; it only takes a minute: Sign up '\r': command not found - .bashrc / .bash_profile up vote 101 down vote favorite 33 I have windows, using Cgywin, trying to Why do the Avengers have bad radio discipline?

Other freeware and nagware archiving tools supp...