Home > Syntax Error > Echo Syntax Error Near Unexpected Token

Echo Syntax Error Near Unexpected Token

Contents

Perhaps you have a non-printable in there causing the fault. –Michael Berkowski Jan 3 '14 at 3:28 4 @user3155779 Could you close the question, since the actual problem didn't relate If you'd like to contribute content, let us know. 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 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. http://csimonitoring.com/syntax-error/eclipse-syntax-error-on-token-delete-this-token.php

f1 () { echo "Calling function \"f2\" from within function \"f1\"." f2 } f2 () { echo "Function \"f2\"." } f1 # Function "f2" is not actually called until this point, UNIX is a registered trademark of The Open Group. My math students consider me a harsh grader. Browse other questions tagged bash shell ssh jboss or ask your own question. http://stackoverflow.com/questions/20666207/syntax-error-near-unexpected-token-echo

Syntax Error Near Unexpected Token C

Not the answer you're looking for? If so, is there a reference procedure somewhere? Has Tony Stark ever "gone commando" in the Iron Man suit? Use it like this: script_debug=1 # to turn it off, set script_debug=0 debugme logger "Sorting the database" database_sort debugme logger "Finished sorting the database, exit code $?" Of course this can

Where (or to whom) do sold items go? Join our community today! 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 Syntax Error Near Unexpected Token Javascript students who have girlfriends/are married/don't come in weekends...?

Unable to pass result of one command as argument to another How to make denominator of a complex expression real? Syntax Error Near Unexpected Token Do Aigarzs View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by Aigarzs Thread Tools Show Printable Version Email this Page Search this Thread Advanced Looking for a term like "fundamentalism", but without a religious connotation more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info http://askubuntu.com/questions/372926/bash-syntax-error-near-unexpected-token Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug Syndicate Latest

exit $? # It is even possible to use functions to override #+ or preempt system commands. # Of course, this is *not* advisable.

Syntax Error Near Unexpected Token Do

Folding Numbers Male header pins on Arduino Uno Log all users out of all locations after 24 hours Is there a word for an atomic unit of flour? http://unix.stackexchange.com/questions/92915/bash-syntax-error-near-unexpected-token in the very first line of a script. Syntax Error Near Unexpected Token C Does Zootopia have an intentional Breaking Bad reference? Syntax Error Near Unexpected Token Fi Windows-1252 is a superset of ISO-8859-1, thus they are not the same.

How to make denominator of a complex expression real? this contact form share|improve this answer answered Dec 18 '13 at 18:59 Guntram Blohm 7,7632721 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Error messages actually mean something. Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... unix and linux commands - unix shell scripting Syntax error Syntax Error Near Unexpected Token Else

Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. A similar question and answer that references file encoding is here: bad character showing up in bash script execution share|improve this answer edited Jan 5 '14 at 6:25 answered Jan 5 Why? http://csimonitoring.com/syntax-error/eclipse-syntax-error-on-token.php 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

I am invoking as: $ ./script.sh –Ketan Nov 17 '14 at 17:43 @Ketan I am invoking it as sh script.sh. Bash Syntax Error Near Unexpected Token share|improve this answer answered Nov 17 '14 at 18:29 Sudev Jash 2513 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google pid=$(< fooservice.pid) echo "DEBUG: read from file: pid=\"$pid\"" >&2 Bash's printf command has the %q format, which is handy for verifying whether strings are what they appear to be.

Is it permitted to not take Ph.D.

The whole error message is printed, but you see only part of it! https://gist.github.com/kartonnade/44e9842ed15cf21a3700 alias carriage_return=remove_carriage_return remove_carriage_return(){ # cygwin throws error like : # syntax error near unexpected token `$'{\r'' # due to carriage return # this function runs the following # cat originalfile You are currently viewing LQ as a guest. Syntax Error Near Unexpected Token Perl A function call is equivalent to a command.

Example 24-1.

if [ "$USER" = bozo ] then bozo_greet () # Function definition embedded in an if/then construct. { echo "Hello, Bozo." } fi bozo_greet # Works only for Bozo, and other Cartesian vs. This is a classic mistake Read the error messages Many people come into IRC and ask something like "Why does my script fail? Check This Out Writing referee report: found major error, now what?

http://sourceforge.net/projects/basheclipse/ Paolo Supino, 2012/01/02 10:20 not knowing of bash debugger existance I wrote a small script (I called debug.sh) that sets -x, -xv or -xvn (depending on the parameter passed debug.sh). They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. If it is not in the man pages or the how-to's this is the place! 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

EOF cat <

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 Browse other questions tagged linux bash shell scripting or ask your own question. 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 Change *Completions* list to sort vertically?

At what point in the loop does integer overflow become undefined behavior?