Home > Syntax Error > Syntax Error Near Unexpected Token Fi' Shell Script

Syntax Error Near Unexpected Token Fi' Shell Script

Contents

Simon Bridge View Public Profile View LQ Blog View Review Entries View HCL Entries Visit Simon Bridge's homepage! Can a free radical be created by chemical reaction of non-radical species? 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. 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 Source

Any idea what I am missing? Unable to understand the details of step-down voltage regulator Close current window shortcut A pilot's messages Disease that requires regular medicine Plus and Times, Ones and Nines more hot questions question Will majority of population dismiss a video of fight between two supernatural beings? Print This Log in or register to post comments Like (0 likes) 2 Comments Comments RecommendedDate October 8, 2010 #2 mfillpot You don't need the double brackets and you don't need

Syntax Error Near Unexpected Token Fi' Shell Script

Something like this should work for you: read -p 'What to do? 1.Start or 2.Stop. [1/2] ' action if [ $action -eq 1 ]; then start_openvpn elif [ $action -eq 2 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 Are you sure that's the exact script you tested with?

Why are terminal consoles still used? asked 3 years ago viewed 5793 times active 3 years ago Linked 2 bash: syntax error near unexpected token `}' Related 3Writing a bash script for apache conf files3Error in R: echo "hello World" # a=1 b=2 echo "A: $a" echo "B: $b" if [ "$a" -eq "$b" ]; then echo "equal" else echo "Not equal" fi Every time I run that, Syntax Error Near Unexpected Token Fi Linux What does "put on one's hat" mean?

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 Syntax Error Near Unexpected Token Fi Mac 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. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. Are you new to LinuxQuestions.org?

Beside that, spaces around ['s arguments are mandatory. –manatwork Sep 30 '13 at 15:40 also see that [1==2] must have space between the [ , ] and the numbers, Syntax Error Near Unexpected Token For For example, some linux systems will use busybox, dash, ash... Rebus: Guess this movie What are the ground and flight requirements for high performance endorsement? 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 Fi Mac

Can you check with cat -v or simply create a new script and copy/paste the above yourself? Thanks Last edited by vbe; 09-16-2014 at 09:57 AM.. Remove advertisements Sponsored Links duncanyy View Public Profile Find all posts by duncanyy #2 09-16-2014 manuswami Registered Syntax Error Near Unexpected Token Fi' Shell Script Moderator's Comments: Please use code tags next time for your code and data. Syntax Error Near Unexpected Token Fi' In Unix The functions are above it in the script. # Main echo -n "What to do? 1.Start or 2.Stop. [1/2]" read action if [ "$action" == "1" ] then start_openvpn() elif [

All Rights Reserved. this contact form An expensive jump with GCC 5.4.0 Lagrange multiplier on unit sphere more hot questions question feed lang-sh about us tour help blog chat data legal privacy policy work here advertising info Why are there no toilets on the starship 'Exciting Undertaking'? Not the answer you're looking for? Syntax Error Near Unexpected Token Fi' Cygwin

I went and used the menu to switch it back, and now it works like a charm! –DarthCaniac May 9 '12 at 20:03 Mind if I point out that Just put a # before the else as well. Please visit this page to clear all LQ-related cookies. http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-shell-script.html How to decrypt .lock files from ransomeware on Windows How do I reassure myself that I am a worthy candidate for a tenure-track position, when department would likely have interviewed me

Display a Digital Clock Resubmitting elsewhere without any key change when a paper is rejected default override of virtual destructor Is an internal HDD with Ubuntu automatically bootable from an external Fi' Unexpected Ksh The shell will interpret than as part of test-commands, but then it finds a fi statement, which is incorrect (and, yes, unexpected) because it never encountered the then part. If you get other errors after removing those then you have problems with some other line or you changed something else as well. –Etan Reisner Nov 13 '14 at 18:11 add

share|improve this answer edited Oct 30 '11 at 13:15 answered Oct 30 '11 at 13:09 Riccardo Murri 10.9k53647 thank you Mr.Riccardo –Beginners Oct 30 '11 at 13:19 add a

What are the ground and flight requirements for high performance endorsement? Not the answer you're looking for? uselpa View Public Profile View LQ Blog View Review Entries View HCL Entries View LQ Wiki Contributions Find More Posts by uselpa Thread Tools Show Printable Version Email this Page Syntax Error Near Unexpected Token `then' UNIX is a registered trademark of The Open Group.

pls note that I add #else with the script. Why is the Vitamin B complex, a "complex"? Search this Thread 09-06-2008, 06:03 AM #1 deb4you LQ Newbie Registered: Sep 2008 Posts: 2 Rep: why am getting error ksh: syntax error: `fi' unexpected while running script Hi http://netlookmag.com/syntax-error/syntax-error-near-unexpected-token-then-39-in-shell-script.html Which window?

Rebus: Guess this movie Why would Snape set his office password to 'Dumbledore'? See here. –terdon♦ Sep 30 '13 at 16:08 add a comment| Not the answer you're looking for? if [ 1 -eq 2 ]; then echo 'y'; fi share|improve this answer answered Sep 30 '13 at 15:43 Spack 1,240711 == does exist in bash, it just does Longer story: the syntax of the if command is this (boldface characters mark words that cannot be omitted or replaced): if test-commands; then commands; fi where you can replace the ;

One more doubt........ The first statement works, but then I get the message: "Syntax error: "fi unexpected(expcting then)" My code: #!/bin/bash read -p "Start BungeeCord (y/n)" choice if [ "$choice" == "y" ]; then 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 How many times do you need to beat mom and Satan etc to 100% the game?

Having a problem logging in? Outlet w/3 neutrals, 3 hots, 1 ground?