Home > Syntax Error > Bash Shell Syntax Error Near Unexpected Token

Bash Shell Syntax Error Near Unexpected Token

Contents

How does Gandalf get informed of Bilbo's 111st birthday party? Why? Having a problem logging in? Some possible sources of CRs: a DOS/Windows text editor a UNIX® text editor that is "too smart" when determining the file content type (and thinks "it's a DOS text file") a Check This Out

Reading and interpreting error messages is 50% of your job as debugger! This site is not affiliated with Linus Torvalds or The Open Group in any way. or, programming style, and as per suggestion for i in {1..22} do /home/aydar/Desktop/vcftools_0.1.13/bin/vcftools \ --vcf $VCF_FILE --chr $i --out ./by_chrs_komi/$i --recode done share|improve this answer edited Dec 11 '15 at 14:35 dash instead of bash). –steeldriver Aug 24 '14 at 14:28 I have #!/bin/sh at the top.

Shell Syntax Error Near Unexpected Token Done'

bash scripts wget share|improve this question asked Nov 8 '13 at 10:27 Registered User 1,15472237 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote accepted You Were slings used for throwing hand grenades? Password Programming This forum is for all programming questions.

Here's what happens because of the #!/bin/bash^M in our shebang: the file /bin/bash^M doesn't exist (hopefully) So Bash prints an error message which (depending on the terminal, the Bash version, or Simple functions

#!/bin/bash # ex59.sh: Exercising functions (simple). share|improve this answer edited yesterday Stéphane Chazelas 175k28281504 answered Aug 24 '14 at 16:09 cuonglm 71.1k13111196 add a comment| up vote 1 down vote Here's another workaround. Linux Syntax Error Near Unexpected Token Newline' no outgoing connection via ipv4 Please explain the local library system in London, England more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work

Alias expansion happens before the real language interpretion, thus the alias is expanded and makes your function definition invalid. Syntax Error Near Unexpected Token In Shell Script How to deal with a very weak student? some code ... grail View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by grail 07-10-2010, 11:37 PM #6 rc5gd LQ Newbie Registered: Jul 2010 Posts:

Real name: E-Mail: Website: Enter your comment. Syntax Error Near Unexpected Token (' In Linux Add this assignment PS4 at the beginning of your script to enable the inclusion of that information: export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' Be sure to use single quotes here! If you'd like to contribute content, let us know. Currently i can not reach my server(remote one, on which i am trying to integrate my application ) to test these solutions, i guess there is a network issue.

Syntax Error Near Unexpected Token In Shell Script

Why are some programming languages Turing complete but lack some abilities of other languages? The question does not have to be directly related to Linux and any language is fair game. Shell Syntax Error Near Unexpected Token Done' Not the answer you're looking for? Syntax Error Near Unexpected Token Else' In Shell Script Consider the following script, written with a Windows® text editor (^M is a symbolic representation of the CR carriage return character!): #!/bin/bash^M ^M echo "Hello world"^M ...

zirias View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by zirias 07-09-2010, 04:25 PM #3 DaneM Member Registered: Oct 2003 Location: Chico, his comment is here Note: It seems that here-documents (tested on versions 1.14.7, 2.05b, 3.1.17 and 4.0) are correctly terminated when there is an EOF before the end-of-here-document tag (see redirection). Least Common Multiple Unexpected parent process id in output Train ride from Copenhagen to Malmo What type of sequences are escape sequences starting with "\033]" Good way to explain fundamental theorem With some paste implementations, you can omit it though that's not standard. Linux Syntax Error Near Unexpected Token Then'

How can I find and eliminate them? Following that, and since I keep having this issue with carriage return, I wrote that small script. Use a good editor Your choice of editor is a matter of personal preference, but one with Bash syntax highlighting is highly recommended! this contact form debugme set +x Dry-run STDIN driven commands Imagine you have a script that runs FTP commands using the standard FTP client: ftp [email protected] <

I will get back to you soon. Bash Syntax Error Near Unexpected Token R This is exact way i was trying to do. [mycom7] # ./ctopo.sh um_test1 [(1,2),(2,1)] bash: syntax error near unexpected token `(' ctopo.sh script takes two strings as input, here first one linux bash shell scripting share|improve this question edited Dec 7 '15 at 20:12 Tomasz Jakub Rup 4,98471335 asked Jan 3 '14 at 3:20 user3155779 43113 still the same .

Why not? # Now, let's invoke the function. _ # __________ # ^^^^^^^^^^ 10 underscores (10 x function name)! # A "naked" underscore is an acceptable function name. # In fact,

Bash 4.0 added an extra message for this: warning: here-document at line delimited by end-of-file (wanted `') Unexpected end of file while looking for matching ... It sounds like the shell was complaining about the ^M carriage return character, not the quote as the OP seemed to indicate. –Potatoswatter Jan 5 '14 at 4:41 | show 1 If you're lucky, you'll get: bash: ./testing.sh: /bin/bash^M: bad interpreter: No such file or directory which alerts you to the CR. Syntax Error Near Unexpected Token Bash Function Adopt A Jet/Book How does the pilot control the Dassault Rafale?

The various parts of the script prompt are printed in color. You are currently viewing LQ as a guest. What does Sauron need with mithril? http://gatoisland.com/syntax-error/bash-for-syntax-error-near-unexpected-token.php Why?

Also, none of this will make a quote mark show up in an otherwise ASCII file, so -1. –Potatoswatter Jan 5 '14 at 2:20 @Potatoswatter, Windows uses UTF-16 'internally' It happens in interactive shells, when the C-Shell-styled history expansion ("!searchword") is enabled.

© Copyright 2017 gatoisland.com. All rights reserved.