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

Syntax Error Near Unexpected Token Fi' Shell Script

Contents

Is resset.log a typo, or do you really have three different logs? Thanks Last edited by vbe; 09-16-2014 at 08:57 AM.. Remove advertisements Sponsored Links duncanyy View Public Profile Find all posts by duncanyy #2 09-16-2014 manuswami Registered Browse other questions tagged bash command-line scripting sh or ask your own question. How to preserve content of variable after pipe Do editors know how many papers I am refereeing on the same platform? this content

Is it unethical of me and can I get in trouble if a professor passes me based on an oral exam without attending class? 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. if [ 1 -eq 2 ]; then echo 'y'; fi share|improve this answer answered Sep 30 '13 at 15:43 Spack 1,220611 == does exist in bash, it just does 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. http://stackoverflow.com/questions/20586785/syntax-error-near-unexpected-token-fi

Syntax Error Near Unexpected Token Fi' Shell Script

Useful link: http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html share|improve this answer answered Sep 30 '13 at 15:41 dchirikov 2,375714 add a comment| up vote 3 down vote The correct form of the bash if construct is is it possible? If I am told a hard number and don't get it should I look elsewhere? Are illegal immigrants more likely to commit crimes?

Thanks Last edited by vbe; 09-16-2014 at 08:58 AM.. Remove advertisements Sponsored Links manuswami View Public Profile Visit manuswami's homepage! I hesitated on suggesting a specific solution for that because of the loose relationship between log files and output streams in the given script. –type_outcast Dec 5 '15 at 5:39 Unix & Linux Stack Exchange works best with JavaScript enabled current community chat Unix & Linux Unix & Linux Meta your communities Sign up or log in to customize your list. Syntax Error Near Unexpected Token For Should the format work at the command line when not in a program? $ if [1==2] then echo "y" fi; > ; -bash: syntax error near unexpected token `;' command-line share|improve

Browse other questions tagged bash shell syntax-error or ask your own question. Once you have removed the characters; you can execute it as many times as you want until you corrupt it again. asked 2 years ago viewed 42833 times active 1 year ago Related 1bash - syntax error near unexpected token `<'4Confusing syntax error near unexpected token 'done'2Bash syntax error when commented out http://stackoverflow.com/questions/30037627/syntax-error-fi-unexpected-expecting-then-in-bash-script Should there really be 1E6 ohm resistance between an anti-static wrist strap and a pc?

What is a EH-Number™ more hot questions lang-bsh about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture Syntax Error: "fi" Unexpected (expecting "then") What is the difference between brake cables and derailleur cables? LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie why am getting error ksh: syntax error: `fi' unexpected while running script User Name Remember Me? 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

  1. also, consider if :; then :; fi >>log –mikeserv Dec 5 '15 at 4:53 or use the character \ for breaking lines so it would be easier to read.
  2. Join them; it only takes a minute: Sign up Syntax error: “fi” unexpected (expecting “then”) in bash script up vote 1 down vote favorite I try to do the script: #!/bin/bash
  3. The Rule of Thumb for Title Capitalization Automata for empty language C++ Get min / max value of a static array at compile time Did I participate in the recent DDoS
  4. Try converting to UNIX format first: Code: tr -d '\r' < scriptfile > newscriptfile --- After that, you will probably also need to change Code: if [[ $? == 0 ]]
  5. the answer has already been accepted... –Chris Maes Apr 12 '14 at 9:29 This does not provide an answer to the question.
  6. s024[/home/oracle]$. /home/oracle/scripts/arch_backup.ksh proddb ksh: syntax error: `fi' unexpected the part of script where if statement is used...........
  7. Was the term "Quadrant" invented for Star Trek When a girl mentions her girlfriend, does she mean it like lesbian girlfriend?

Syntax Error Near Unexpected Token Fi' In Unix

Just put a # before the else as well. http://www.linuxquestions.org/questions/linux-newbie-8/why-am-getting-error-ksh-syntax-error-%60fi'-unexpected-while-running-script-667926/ Type type [ to see what is really happening. Syntax Error Near Unexpected Token Fi' Shell Script Search Forums Show Threads Show Posts Tag Search Advanced Search Unanswered Threads Find All Thanked Posts Go to Page... unix and linux operating commands Syntax error: 'fi' unexpected Shell Syntax Error Near Unexpected Token Fi Mac Not the answer you're looking for?

How to preserve content of variable after pipe Should I use the formal form (~ます) on the buttons of an app? news So here's your script: #!/bin/bash echo "start" for f in *.jpg do fname="${f##*/}" echo "fname is $fname" if (( fname % 2 == 1 )); then echo "removing $fname" rm -- 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 How to preserve content of variable after pipe Why are my prints low quality when screenshotting a PDF? Syntax Error Near Unexpected Token Fi' Cygwin

Training Certification Events Webinars CommunityParticipate Q&A Forums Blogs ResourcesNewsletter Distributions Publications Infographics Photos Videos Jobs About Linux.comTerms of Use Privacy Policy Editorial Policy Contact The Linux Foundation is a non-profit consortium 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 If it is listening it'll reply. http://internetmairie.com/syntax-error/syntax-error-near-unexpected-token-function.html More info here Also there's no need to use \n in every echo, because echo places newlines by default.

Ask Ubuntu works best with JavaScript enabled Notepad++ Convert To Unix New employee has offensive Slack handle due to language barrier Which kind of "ball" was Anna expecting for the ballroom? Better translation for "Roadblock" on projects language Approximation of the Gamma function for small value What exactly is a "bad" "standard" or "good" annual raise?

command-line bash scripts sh share|improve this question edited May 4 '15 at 19:12 0xF2 2,03621538 asked May 4 '15 at 18:40 Kwiatkowski 91 closed as off-topic by muru, Fabby, David Foerster,

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 Print the digital root What is the rationale behind decltype behavior? 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 Syntax Error Near Unexpected Token `then' 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.

Equivalent for "Crowd" in the context of machines Automata for empty language Is it unethical of me and can I get in trouble if a professor passes me based on an Most of the scripts in your ubuntu install has no extension. –geirha May 4 '15 at 19:44 Because packaging guidelines recommend that scripts in PATH shouldn't have extensions, so Why are my prints low quality when screenshotting a PDF? http://internetmairie.com/syntax-error/syntax-error-near-unexpected-token-39-in-linux.html 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

What does "Game of the Year" actually mean? Does WiFi traffic from one client to another travel via the access point? So, in your case, sh (or whatever Bourne shell you appear to be using), interprets the quotes as if they're balanced, which results in parts of your script being "quoted" which This is my code: #!/bin/bash echo "start\n" for f in *.jpg do fname=$(basename "$f") echo "fname is $fname\n" fname="${filename%.*}" echo "fname is $fname\n" if[$((fname % 2)) -eq 1 ] then echo

Password Linux - Newbie This Linux forum is for members that are new to Linux. Where I can learn Esperanto by Spanish? Creating new renderings that are compatible with SXA Algebraic objects associated with topological spaces. I corrected this problem, too. –peterh Dec 14 '13 at 18:46 Still has many errors. –Aleks-Daniel Jakimenko-A.

And what do I care about some random fellows rambling's? -1 for nonsense. –muru May 4 '15 at 19:37 @muru, Then Ubuntu does not follow this old "convention" of This $'' syntax is explained here To make it completely perfect you should place -- before arbitrary filenames, otherwise rm might treat it as a parameter if the file name starts share|improve this answer answered May 4 '15 at 20:01 Diego Torres Milano 39.6k55988 add a comment| up vote 2 down vote Most probably this is because carriage-return \r in your script. after I add on this at my script.

How to explain centuries of cultural/intellectual stagnation? Which window? will not do what you (probably) want, here. Can a Grappled Monk viably use Open Hand Technique to end the grapple?

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.