Home > Syntax Error > Syntax Error Near Unexpected Token Elif' Bash

Syntax Error Near Unexpected Token Elif' Bash

Contents

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 When I create a script then manually add the CR characters, I get exactly the same error: qq.sh: line 3: syntax error near unexpected token `elif' 'q.sh: line 3: `elif [ Reason: added link Adv Reply November 5th, 2011 #4 gsmanners View Profile View Forum Posts Private Message Fresh Brewed Ubuntu Join Date Feb 2008 Beans 1,145 DistroXubuntu Re: Syntax error It just did not solve all the problems in the question. –lesmana Aug 22 '13 at 12:39 if is syntax, it isn't an ordinary command. http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-elif-39-in-linux.html

Can a free radical be created by chemical reaction of non-radical species? Close current window shortcut Why is the Vitamin B complex, a "complex"? 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 If you'd like to contribute content, let us know.

Syntax Error Near Unexpected Token Elif' Bash

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 More info here Also there's no need to use \n in every echo, because echo places newlines by default. ls elif [ "$choice2" = "Back" ]; then tehstart else echo Sorry, Thats not an option fi done elif [ "$choice" = "Make/EditFile" ] read -p "What should the file name

Browse other questions tagged shell or ask your own question. Hope this clears things up. fi Mind the spaces please. Syntax Error Near Unexpected Token `elif' In Unix 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

Search this Thread 05-10-2010, 04:32 AM #1 lucmove Member Registered: Aug 2005 Location: Brazil Distribution: Debian Jessie Posts: 715 Rep: bash: syntax error near unexpected token `else' Code: for Syntax Error Near Unexpected Token Fi' Shell Script Click Here to receive this Complete Guide absolutely free. Was moving script from a windows machine to linux. –Soth Apr 28 '14 at 13:00 This worked well for me, I created a sh on windows using EditPlus, and Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart?

The time now is 04:20 AM. Syntax Error Near Unexpected Token Else In Shell Script 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 It is common and well known since the beginning of Oracle database. –user75ponic Aug 23 '13 at 6:36 @Polppan : oh, thanks for that info ^^ –Olivier Dulac Aug Are there too few Supernova Remnants to support the Milky Way being billions of years old?

Syntax Error Near Unexpected Token Fi' Shell Script

Another problem is that you didn't quote "$f" which might become a problem later. Browse other questions tagged bash shell-script shell windows or ask your own question. Syntax Error Near Unexpected Token Elif' Bash I think 61 might be the problem. Syntax Error Near Unexpected Token Elif' In Linux Dec 14 '13 at 19:37 | show 2 more comments up vote 5 down vote Use Notepad ++ and use the option to Convert the file to UNIX format.

The time now is 11:20 PM. - Contact Us - UNIX & Linux - unix commands, linux commands, linux server, linux ubuntu, shell script, linux distros. - Advertising - Top this content User contributions on this site are licensed under the Creative Commons Attribution Share Alike 4.0 International License. Still I don't like your if expression, there's no point to use test command there. Is there any financial benefit to being paid bi-weekly over monthly? Syntax Error Near Unexpected Token Fi Mac

I disagree with you. Dec 14 '13 at 19:16 Not many, only 2. :-) –peterh Dec 14 '13 at 19:19 add a comment| up vote 1 down vote The first problem with your do you get an error? http://mmonoplayer.com/syntax-error/syntax-error-near-unexpected-token-bash-function.html How to properly localize numbers?

Quote: When if and then are on same line in a condition test, a semicolon must terminate the if statement. Syntax Error Elif Unexpected Expecting Then 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 Join them; it only takes a minute: Sign up Syntax error near unexpected token 'fi' up vote 21 down vote favorite 2 I'm trying to write a script that removes all

Adv Reply March 6th, 2009 #4 ghostdog74 View Profile View Forum Posts Private Message I Ubuntu, Therefore, I Am Join Date Sep 2006 Beans 2,914 Re: Bash - syntax error

Lagrange multiplier on unit sphere How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me even if I wasn't? Rather than fragments, please post a minimal test case. –outis Nov 15 '10 at 7:04 @outis I am using bash –Strawberry Nov 15 '10 at 7:05 What Make iti executable and call it directly or at least call it with bash. If Elif Bash A pilot's messages An electronics company produces devices that work properly 95% of the time measurable linear functionals are also continuous on separable Banach spaces?

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 asked 6 years ago viewed 6324 times active 2 years ago Related 7Syntax error near unexpected token `elif'1Shell syntax error near unexpected token `done' 1Syntax error near unexpected token - shell It should be: if [ "$i" == '.' ] then or if [ "$i" == '.' ]; then Hope this helps. check over here echo $BASH_VERSION –outis Nov 15 '10 at 7:06 3.2.0(1)-release –Strawberry Nov 15 '10 at 7:07 Works fine for me with 4.1.5(1)-release, might be something in your old

lucmove View Public Profile View LQ Blog View Review Entries View HCL Entries Find More Posts by lucmove Thread Tools Show Printable Version Email this Page Search this Thread Advanced