Home > Syntax Error > Syntax Error Near Unexpected Token Elif' In Linux

Syntax Error Near Unexpected Token Elif' In Linux

Contents

you can use Code: set -x in your script to help in debugging. 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 Join them; it only takes a minute: Sign up How can I fix shell error “syntax error near unexpected token 'elif'” up vote 2 down vote favorite I have this run It meant that bash was in some mode that it was not understanding "elif". Source

Please visit this page to clear all LQ-related cookies. Browse other questions tagged shell or ask your own question. See my edits in bold Adv Reply March 6th, 2009 #9 jenkinbr View Profile View Forum Posts Private Message Has an Ubuntu Drip Join Date Dec 2007 Location *eating something* grail View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by grail 05-10-2010, 11:15 AM #4 tuxdev Senior Member Registered: Jul 2005 Distribution:

Syntax Error Near Unexpected Token Elif' In Linux

The problem in the last examples is that you forgot a space between if and [ and between elif and [. A pilot's messages Is an internal HDD with Ubuntu automatically bootable from an external USB case? current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. This should work: Code: $ for i in $(ls -1a); do > if [ "$i" == '.' ]; then echo 'one dot' > elif [ "$i" == '..' ]; then echo

lucmove View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by lucmove 05-10-2010, 09:30 PM #9 grail LQ Guru Registered: Sep 2009 Location: I remember that code now: /* * IF it is possible to put the base shell into POSIX/Bourne mode, * THEN do so... */ > if test -n "${ZSH_VERSION+set}" && (emulate Thomas Steudten does the packaging, so I must profess ignorance. Syntax Error Elif Unexpected Expecting Then Last edited by Franklin52; 09-19-2009 at 01:01 PM..

options = "ListFiles Make/EditFile Quit" select choice in $options; do if [ "$choice" = "ListFiles" ]; then echo Would you like to list the files of the current directory, or a Syntax Error Near Unexpected Token `elif' In Unix Thanks, Ron Arts $ make autogen -b uw_send -Dconfdir=/etc/upwatch.d -Dsysconfdir=/etc -Dsbindir=/usr/sbin -Dlogdir=/var/log/upwatch -Dspooldir=/var/spool/upwatch -L /usr/local/share/autogen -L ../common -T ../common/spec.tpl cmd_options.def /bin/bash: line 6: syntax error near unexpected token `elif' 'bin/bash: line share|improve this answer edited Nov 15 '10 at 7:20 answered Nov 15 '10 at 7:15 paxdiablo 499k1229851441 +1, Nice approach. –codaddict Nov 15 '10 at 7:16 2 Nice Both if and then are keywords.

Keywords (or commands) begin statements, and before a new statement on the same line begins, the old one must terminate. 0 members found this post helpful. If Elif Bash umm, i think i need another hint... The text in the error > messages look like .profile type text, trying to determine if > the current shell is bash. share|improve this answer answered Nov 15 '10 at 7:12 Chris Morgan 44.6k884135 OS X uses \n just like Linux and Unix (since it is a member of the family).

Syntax Error Near Unexpected Token `elif' In Unix

Hit a curb today, taking a chunk out of the tire and some damage to the rim. Worf! Syntax Error Near Unexpected Token Elif' In Linux Adv Reply March 6th, 2009 #10 Squigy Dunkens View Profile View Forum Posts Private Message 5 Cups of Ubuntu Join Date Mar 2009 Beans 27 Re: Bash - syntax error Syntax Error Near Unexpected Token Fi' Shell Script Subscribed!

Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. this contact form Python tutorial |Unix power tools|Effective AWK|A handful of Awk|Perl|File Renamer|Bash ref Adv Reply March 6th, 2009 #3 Squigy Dunkens View Profile View Forum Posts Private Message 5 Cups of Ubuntu What are some counter-intuitive results in mathematics that involve only finite objects? I disagree with you. Syntax Error Near Unexpected Token Else In Shell Script

Can a free radical be created by chemical reaction of non-radical species? grail View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by grail 05-10-2010, 10:03 PM #10 lucmove Member Registered: Aug 2005 Location: Brazil joshuaduan Shell Programming and Scripting 8 05-14-2007 10:02 AM syntax error at line 33: `elif` unexpected hazy UNIX for Dummies Questions & Answers 4 02-09-2006 02:51 PM All times are GMT http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-39-in-linux.html But something is up with the ELSE statement: Code: luc$[519]test> for i in $(ls -1a); do > if[ "$i" == '.' ] then > echo 'one dot' > elif[ "$i" ==

The corrected command is below. #!/bin/bash if [ -e /fms2005/Sample/CronFlag.txt ] ; then echo "data file does exist" else echo "data file does not exist" fi Top Log in or register Syntax Error Near Unexpected Token (' Bash Still stumped. thanks in advance...

Screenshot instructions: Windows Mac Red Hat Linux Ubuntu Click URL instructions: Right-click on ad, choose "Copy Link", then paste here → (This may not be possible with some types of

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 Adv Reply March 6th, 2009 #2 ghostdog74 View Profile View Forum Posts Private Message I Ubuntu, Therefore, I Am Join Date Sep 2006 Beans 2,914 Re: Bash - syntax error Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? Syntax Error: Unexpected End Of File Join our community today!

How should I tell my employer? That seems odd. I have some more labor intensive > suggestions if this proves to be insufficient. Check This Out i didnt know that.

Another thing is that I think the code it flukes on is in agen5/agShell.c Ron > Ron Arts wrote: > >>This is a cygwin-only problem. Success! See below. Contact Us - Advertising Info - Rules - LQ Merchandise - Donations - Contributing Member - LQ Sitemap - Main Menu Linux Forum Android Forum Chrome OS Forum Search LQ

We recommend upgrading to the latest Safari, Google Chrome, or Firefox. Help my maniacal wife decorate our christmas tree How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me even Browse other questions tagged bash unix if-statement or ask your own question. I have some more labor intensive suggestions if this proves to be insufficient.

Join Date May 2008 Beans 77 Re: Bash - syntax error near unexpected token `elif' Originally Posted by Squigy Dunkens i am learning bash, and i made this program just for You signed in with another tab or window. Let me know. > Regards, Bruce > I thought so too at first. 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.

I also searched this forum. They do not always work the same: Code: $ cat foobar #!/bin/bash for i in $(ls -1a); do if [ "$i" == '.' ] then echo 'one dot' elif [ "$i" Will majority of population dismiss a video of fight between two supernatural beings?