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

Bash Shell Syntax Error Near Unexpected Token

Contents

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' I just copied the example into notepad and saved, then copied to linux and sh ./file produces unexpected token errors, including `' type references. So to take your script, ask yourself if the following would work: Code: /usr/bin/plcsh /root/gra2.py um_test1 [(1,2),(2,1)] Then test it on the command line to confirm. Wiki syntax is allowed: Please fill all the letters into the box to prove you're human. his comment is here

The difference lies in the use of the CR (Carriage Return) and LF (Line Feed) characters. UbuntuCommunityAsk!DeveloperDesignDiscourseHardwareInsightsJujuShopMore ›AppsHelpForumLaunchpadMAASCanonical current community chat Ask Ubuntu Ask Ubuntu Meta your communities Sign up or log in to customize your list. Why write an entire bash script in functions? There is no method of "declaring" the function, as, for example, in C.

Shell Syntax Error Near Unexpected Token Done'

and is writable ? –Archemar Dec 11 '15 at 15:09 1 is that by_chrs_komi (with s) or by_chr_komi (without) ? –Archemar Dec 11 '15 at 15:21 | show 3 more What to tell to a rejected candidate? Remove advertisements Sponsored Links raghunsi View Public Profile Find all posts by raghunsi

Page 1 of 2 1 2 > « Previous Thread | Next Thread » Thread Tools Show

Forum Operations by The UNIX and Linux Forums Script should work, if you call bash directly bash test.sh. Why did companions have such high social standing? Linux Syntax Error Near Unexpected Token Newline' Recursion Without Local Variables

Like "real" programming languages, Bash has functions, though in a somewhat limited implementation.

f1 # Still an error message. # However... Syntax Error Near Unexpected Token In Shell Script My girlfriend has mentioned disowning her 14 y/o transgender daughter What type of sequences are escape sequences starting with "\033]" Should indoor ripened tomatoes be used for sauce? Did Donald Trump call Alicia Machado "Miss Piggy" and "Miss Housekeeping"? I executed as bash test.sh but it did not work either. –NecNecco Aug 24 '14 at 14:49 bash in POSIX mode doesn't support that syntax either (when called with

Join them; it only takes a minute: Sign up syntax error near unexpected token ' - bash up vote 8 down vote favorite 1 I have a written a sample script Syntax Error Near Unexpected Token (' In Linux Symbolic comparison of recursive functions American English: are [ə] and [ʌ] different phonemes? did you close your ( with a )? LinuxQuestions.org > Forums > Non-*NIX Forums > Programming [SOLVED] bash: syntax error near unexpected token `(' User Name Remember Me?

Syntax Error Near Unexpected Token In Shell Script

Too many arguments !": event not found syntax error near unexpected token `(' The CRLF issue What is the CRLF issue? This is unlikely to help. –Cfreak Sep 17 '14 at 15:41 the dos2unix package includes the tool "mac2unix" –Max Mar 16 '15 at 10:20 add a comment| up vote Shell Syntax Error Near Unexpected Token Done' Were slings used for throwing hand grenades? Syntax Error Near Unexpected Token Else' In Shell Script You may ask yourself why is this mentioned as debugging tip?

asked 2 years ago viewed 46333 times active 2 years ago Related 0why syntax error near unexpected token ' fi '0Bash script throws “syntax error near unexpected token `}'” when run0Why http://onlinetvsoftware.net/syntax-error/bash-script-syntax-error-near-unexpected-token.php If the default colors are not suitable than you can set the environment varialbes script_color linenum_color funcname_color to any of the following colors: ${darkgrey}darkgrey$nc, ${lightgrey}light grey$nc, ${white}white, ${red}red, ${lightred}light red, ${green}green, What are the canonical white spaces? Not the answer you're looking for? Linux Syntax Error Near Unexpected Token Then'

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 Life / Arts Culture / Recreation They are especially bad when present in the shebang/interpreter specified with #! Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... learn linux and unix commands - unix shell scripting Syntax weblink It is solved with double quote the second parameter like.. [mycom7] # ./ctopo.sh um_test1 "[(1,2),(2,1)]" rc5gd View Public Profile View LQ Blog View Review Entries View HCL Entries Find More

Let's see the xtrace output: + '[' bar baz = test ']' And now you see that it's ("bar" and "baz") recognized as two separate words (which you would have realized Bash Syntax Error Near Unexpected Token R Symbolic comparison of recursive functions How to extrude a face parallel to another? share|improve this answer answered Jul 10 '14 at 12:38 Patrick 34.1k680129 Thanks that is it –user77083 Jul 10 '14 at 12:43 add a comment| Your Answer draft saved

To display CRs (these are only a few examples) in VI/VIM: :set list with cat(1): cat -v FILE To eliminate them (only a few examples) blindly with tr(1): tr -d '\r'

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 Yes!"; } # ^

Functions are called, triggered, simply by invoking their names. This site is not affiliated with Linus Torvalds or The Open Group in any way. Syntax Error Near Unexpected Token Bash Function it worked ..

Please explain the local library system in London, England What does the "Phi" sign stand for in musical notation? Local Variables24.3. Finding a file starting with '-' dash Natural construction What does Sauron need with mithril? http://onlinetvsoftware.net/syntax-error/bash-for-syntax-error-near-unexpected-token.php This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant.

Dennis numbers 2.0 Which requires more energy: walking 1 km or cycling 1 km at the same speed? Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ How to make different social classes look quite different? as an output statement ..

Use #!/bin/bash. –jordanm Aug 24 '14 at 15:21 @NecNecco: Do you have POSIXLY_CORRECT variable set when you start bash? –cuonglm Aug 24 '14 at 15:31 @jordanm switching READ YOUR ERROR MESSAGES! It's easy to imagine the ^M is bad in other places too. Find all posts by hergp #7 02-03-2010 raghunsi Registered User Join Date: Nov 2008 Last Activity: 26 July 2016, 1:42 PM EDT Location: bangalore Posts: 107 Thanks:

It looks like you are invoking a shell interpreter that doesn't support that syntax (e.g. In that case, there's nothing ANSI about it. –Potatoswatter Jan 5 '14 at 4:01 I suspect the OP's issue was encoding though. Find all posts by hergp #5 02-03-2010 raghunsi Registered User Join Date: Nov 2008 Last Activity: 26 July 2016, 1:42 PM EDT Location: bangalore Posts: 107 It happens in interactive shells, when the C-Shell-styled history expansion ("!searchword") is enabled.

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. The CRLF issue What is the CRLF issue? How to indicate you are going straight? some code ...

If you'd like to contribute content, let us know. but new challlenge for me is to pull the string { admin-state enabled/disabled } from the latest created outFile . Why are some programming languages Turing complete but lack some abilities of other languages?