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

Bash Shell Script Syntax Error Near Unexpected Token

Contents

Will the medium be able to last 100 years? f1 # Still an error message. # However... Natural construction What could cause the throttle to stick in my Ford Ranger? 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, this contact form

not_empty () { : } # Contains a : (null command), and this is okay. # Thank you, Dominick Geyer and Thiemo Kellner.

Linux Syntax Error Near Unexpected Token Then'

Use a unique name for your script Do not name your script test, for example! Beautiful. 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 bash shell share|improve this question edited Sep 23 '13 at 20:51 Gilles 369k666681119 asked Sep 23 '13 at 12:26 user2561310 112 6 Can you post the whole file to pastebin

Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the Please delete my previous version and post this one instead. more hot questions question feed lang-bsh 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 Bash Function I have a suggestion for putting in DEBUG switches.

If you get weird and illogical messages from your script, rule out the possibility that^M is involved. can you give me any such syntax to insert ..this in to my output window . Browse other questions tagged bash scripts wget or ask your own question. Change the shebang (the #!/bin/sh part) to #!/bin/bash.

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 Syntax Error Near Unexpected Token Mac Can I use an HSA as investment vehicle by overcontributing temporarily? Code: exec `/usr/bin/plcsh /root/gra2.py "$slice" "$links"` --Dane DaneM View Public Profile View LQ Blog View Review Entries View HCL Entries View LQ Wiki Contributions Find More Posts by DaneM 07-09-2010, Where it would be useful is when pasting the output of more than one command like in: paste <(cmd1) <(cmd) On systems that support /dev/fd/n, that can be done in sh

Linux Syntax Error Near Unexpected Token Newline'

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: did you close your case with a esac? Linux Syntax Error Near Unexpected Token Then' How to pluralize "State of the Union" without an additional noun? Syntax Error Near Unexpected Token (' In Linux i=0 REPEATS=30 echo echo "And now the fun really begins." echo sleep $JUST_A_SECOND # Hey, wait a second!

Password Programming This forum is for all programming questions. http://sovidi.com/syntax-error/bash-shell-syntax-error-unexpected.php Limit involving exponentials and arctangent without L'Hôpital What could cause the throttle to stick in my Ford Ranger? did you close your ( with a )? This can cause much confusion and many headaches, since lines containing CRs are not what they appear to be when printed. Bash Syntax Error Near Unexpected Token R

The shell interprets the command you are typing, ( and ) are characters with a special meaning for the shell, so you MUST hide them by quoting or by escaping. 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] <navigate here funky fun exit $?

The function definition must precede the first call to it.

Not the answer you're looking for? Bash Syntax Error Near Unexpected Token (' Ubuntu Nobody can debug your script without knowing what actually happened and what went wrong. The \r indicates a carriage return (Linux systems terminate lines with linefeeds \n only).

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 .

This site is not affiliated with Linus Torvalds or The Open Group in any way. i.e. $ cat originalfile | tr -d "\r" > newfile then it would execute. 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 In Case Statement If this works, the issue was carriage returns as hidden characters.

Wiki syntax is allowed: Please fill all the letters into the box to prove you're human. dash instead of bash). –steeldriver Aug 24 '14 at 14:28 I have #!/bin/sh at the top. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the http://sovidi.com/syntax-error/bash-script-syntax-error-near-unexpected-token-do.php Is there a good way to get from Levoča to Lviv?

What shell are you using? Local Variables24.3. Yes, you are right! 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

Is there a way to make a metal sword resistant to lava? Join our community today! Here, you don't need process substitution, you can use standard shell pipes: printf "%s\n" "TOP" | paste - - is the standard way to tell paste to read the data from If you reproduced or fixed the problem, you should mention so.