Home > Syntax Error > Bash Elif Syntax Error

Bash Elif Syntax Error

Contents

Intuition behind Harmonic Analysis in Analytic Number Theory Verbs of buttons on websites How does the pilot control the Dassault Rafale? 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 bash unix if-statement share|improve this question asked Dec 1 '11 at 14:01 t3hcakeman 57631223 add a comment| 3 Answers 3 active oldest votes up vote 4 down vote accepted You need Learn More © 2016 The Linux Foundation This is the mail archive of the [email protected] mailing list for the Cygwin project. this contact form

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 As druuna has pointed out, all of these examples adhere to the rules mentioned. 0 members found this post helpful. i didnt know that. share|improve this answer answered Nov 15 '10 at 7:12 Chris Morgan 43.4k881133 OS X uses \n just like Linux and Unix (since it is a member of the family).

Python Elif Syntax Error

Training Certification Events Webinars CommunityParticipate Q&A Forums Blogs ResourcesNewsletter Distributions Publications Infographics Photos Videos deatharte October 8, 2010 syntax error near unexpected token `fi' Forums:Command Line/Scripting #!/bin/bash if [[ -e ${/fms2005/Sample/CronFlag.txt} What is your name? " name; function tehstart { echo What would you like to do today? What type of sequences are escape sequences starting with "\033]" How to extrude a face parallel to another? ls elif [ "$choice2" = "Back" ]; then tehstart else echo !NOT AN OPTION!

Still stumped. ls elif [ "$choice2" = "Different" ]; then read -p "Ok, which directory do you want to list the files of? " directory; echo Ok, the files in $directory are... Edit: When I add #!/bin/bash at the top, I get the following error: interpreter "/bin/bash" not found file link resolves to "/usr/bin/bash" -bash: ./chkf: /bin/bash^M: bad interpreter: No such file or Bash Syntax Error Near Unexpected Token Fi' Limit involving exponentials and arctangent without L'Hôpital Problem with using pause and onslide in one frame In a GNU C macro envSet(name), what does (void) "" name mean?

Code: if [ "$i" == '.' ] then echo 'one dot' fi If so, I would like to write to the authors of such pages as - http://tldp.org/LDP/abs/html/testconstructs.html And ask them Can Customs make me go back to return my electronic equipment or is it a scam? You can put several commands between if and then, so those semicolons are mandatory. Are there any 'smart' ejection seats?

Old Mac OS versions once used \r. –Dennis Williamson Nov 15 '10 at 7:32 @Dennis: I see; didn't realise it had changed between OS and OS X. –Chris Morgan Bash Syntax Error Invalid Arithmetic Operator What are the holes on the sides of a computer case frame for? if [ -f "$PROJECT_DIR/build/Release-macosx/UnicodeEscape" ] ; then build/Release-macosx/UnicodeEscape "en.lproj/Localizable.strings" ; elif [ -f "$PROJECT_DIR/build/Debug-macosx/UnicodeEscape" ] ; then build/Debug-macosx/UnicodeEscape "en.lproj/Localizable.strings" ; fi share|improve this answer edited Oct 1 '10 at 15:08 answered How rich can one single time travelling person actually become?

Syntax Error Near Unexpected Token Elif

I accepted a counter offer and regret it: can I go back and contact the previous company? If not, why? Python Elif Syntax Error Either use your text editor to save the file without carriage returns or run the script through dos2unix (or perhaps d2u) share|improve this answer answered Sep 11 '13 at 13:08 glenn Bash Syntax Error Near Unexpected Token Done' How to deal with a really persuasive character?

Page 1 of 2 12 Last Jump to page: Results 1 to 10 of 13 Thread: Bash - syntax error near unexpected token `elif' Thread Tools Show Printable Version Subscribe to weblink Not the answer you're looking for? The OP has been edited a few times, so it may be hard to tell if there's another issue involved. –David W. So sayeth the Shepherd Why write an entire bash script in functions? Bash Syntax Error Near Unexpected Token Else'

The time now is 08:58 PM. - Contact Us - Unix & Linux - unix commands, linux commands, linux server, linux ubuntu, shell script, linux distros. - Advertising - Top fi done } tehstart but when i run it it asks for my name, then after i type my name it shows Code: ./yooten.sh: line 29: syntax error near unexpected token It should be: if [ "$i" == '.' ] then or if [ "$i" == '.' ]; then Hope this helps. 1 members found this post helpful. http://sovidi.com/syntax-error/bash-if-syntax-error.php Is the following extension of finite state automata studied?

Having a problem logging in? Bash Syntax Error Near Unexpected Token Then' How to extrude a face parallel to another? bash share|improve this question edited Sep 11 '13 at 13:45 Jens 36.2k863104 asked Sep 11 '13 at 12:54 Meena 112 The script as you show it works fine in

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

you can use Code: set -x in your script to help in debugging. i still get the same error but it says line 30 instead of 27 Adv Reply March 6th, 2009 #8 nunki View Profile View Forum Posts Private Message Just Give I am programmed to greet you and give you a few options in a friendly manner. Bash Syntax Error Near Unexpected Token Do' Yes, I googled.

The question does not have to be directly related to Linux and any language is fair game. HITTING HEAD ON A WALL!!!... Verbs of buttons on websites Activate Hearthstone season chest cards? his comment is here Top Log in or register to post comments Like Leave this field blank Click Here!

asked 3 years ago viewed 2478 times active 2 years ago Visit Chat Linked 6 \n and \r seem to work everywhere. A name for a well-informed person who is not believed? How to indicate you are going straight? Did you edit your script on Windows?

fi done elif [ "$choice" = "Make/EditFile" ];then read -p "What should the file name be, or if your editing a file, what is the file name" filename; vim $filename elif Realism of a setting with several sapient anthropomorphic animal species Can I use an HSA as investment vehicle by overcontributing temporarily? Can you please rephrase? –Jens May 8 '12 at 14:04 add a comment| up vote 4 down vote The then statement needs to be on a new line, or separate from Try to find a standard book about shell programming.

If you edit in vim, you should be able to see the ^M if it's not right through the file. 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 Unexpected parent process id in output What to tell to a rejected candidate? GTIN validation I accepted a counter offer and regret it: can I go back and contact the previous company?

Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Bash - syntax error Training Certification Events Webinars CommunityParticipate Q&A Forums Blogs ResourcesNewsletter Distributions Publications Infographics Photos Videos About Linux.comAdvertise Terms of Use Privacy Policy Editorial Policy Contact The Linux Foundation is a non-profit consortium Modern soldiers carry axes instead of combat knives. options2 = "Current Different Back" select choice2 in $options2; do if [ "$choice2" = "Current" ]; then echo Ok, the files in this directory are...

Is there some kind of invisible character? Join them; it only takes a minute: Sign up Syntax error near unexpected token 'elif' up vote 2 down vote favorite #!/bin/bash if [ "$1" = "boot" ] then if [ Do COB LEDs usually need electrically insulating from the heatsink? 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.

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. Not the answer you're looking for? 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" ==