Home > Syntax Error > Syntax Error Near Unexpected Token Fi' Mac

Syntax Error Near Unexpected Token Fi' Mac

Contents

This site is not affiliated with Linus Torvalds or The Open Group in any way. SOLVED! Not the answer you're looking for? General caveat: As @Scrutinizer points out in a comment, invoking bash as sh implies subtle changes in behavior - see http://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html (*) - though bashisms still work). his comment is here

Adv Reply April 14th, 2015 #2 Keith_Helms View Profile View Forum Posts Private Message Way Too Much Ubuntu Join Date Oct 2013 Location Colorado Beans 290 DistroXubuntu 16.04 Xenial Xerus 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. Plus and Times, Ones and Nines Can a creature with 0 power attack? There must be a space between [[ and first operator.

Syntax Error Near Unexpected Token Fi' Cygwin

measurable linear functionals are also continuous on separable Banach spaces? Why would a NES game use an undocumented 1-byte or 2-byte NOP in production? 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? 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 --

Disease that requires regular medicine Word for nemesis that does not refer to a person Understanding the grammar: «illis Evangelii nuntiandi praebens mandatum» Outlet w/3 neutrals, 3 hots, 1 ground? Ubuntu Logo, Ubuntu and Canonical Canonical Ltd. It works for me –Ashkan May 3 '14 at 19:03 Make sure you don't have any funny "whitespace" in the file. –user2864740 May 3 '14 at 19:04 Syntax Error Near Unexpected Token `done' Training Certification Events Webinars CommunityParticipate Q&A Forums Blogs ResourcesNewsletter Distributions Publications Infographics Photos Videos Jobs deatharte October 8, 2010 syntax error near unexpected token `fi' Forums:Command Line/Scripting #!/bin/bash if [[ -e

asked 3 years ago viewed 22331 times active 4 months ago Related 1/shell-script: syntax error near unexpected token `done'0Shell script - syntax error near unexpected token `['-1Syntax error in bash script: Is resset.log a typo, or do you really have three different logs? bash syntax scripting share|improve this question asked May 9 '12 at 19:47 DarthCaniac 13917 1 Works for me as entered above. –Bittrance May 9 '12 at 19:52 add a comment| Who is spreading the rumour that Santa isn't real?

Of course, you can run chmod +x PreStartupCommands.sh to make your script executable by itself, which makes the problem go away (assuming the problem is related to what executable is processing Syntax Error Near Unexpected Token (' Bash The time now is 04:29 AM. Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? This common pitfall is greatly explained here and here.

Syntax Error Near Unexpected Token For

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 I can only recreate the error you're citing by removing the space between the if and the [ character. Syntax Error Near Unexpected Token Fi' Cygwin Should a country name in a country selection list be the country's local name? Syntax Error Near Unexpected Token `then' So I am between giving this answer -1 or nothing at all... –Aleks-Daniel Jakimenko-A.

What is this strange biplane jet aircraft with tanks between wings? this content But there is another problem, $(( … )) tries to execute "fname % 2", and this is not what you want. Removing brace from the left of dcases Why is bench pressing your bodyweight harder than doing a pushup? How to properly localize numbers? Syntax Error Near Unexpected Token `else'

Change syntax of macro, to go inside braces Square root image filter tool in Python Why does Snoke not cover his face? If condition is any valid bash command, and brackets are equivalent to test, see man test for ref. What mechanical effects would the common cold have? http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-in.html 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

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: Unexpected End Of File Thanks so much! This is explained here.

Change syntax of macro, to go inside braces Hit a curb today, taking a chunk out of the tire and some damage to the rim.

Advertisement Training See all LFS465 Software Defined Networking with OpenDaylight December 12, 2016 Learn more LFS301 Linux System Administration December 12, 2016 Learn more LFD435 Developing Embedded Linux Device Drivers December The reason for space before the ] is similar. share|improve this answer answered Apr 12 '14 at 9:11 Sagar 6911 that is not the correct answer. Unexpected End Of File Bash share|improve this answer answered Aug 22 '13 at 12:03 val0x00ff 3,9071824 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign

How to decrypt .lock files from ransomeware on Windows Why are terminal consoles still used? 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 reward good players, in order to teach other players by example Binary to decimal converter Plus and Times, Ones and Nines Will a tourist have any trouble getting money check over here I will analyze your script a bit more to see if I can't figure out what you're trying to do, and suggest a fixed version, but I confess I don't quite

the answer has already been accepted... –Chris Maes Apr 12 '14 at 9:29 This does not provide an answer to the question. TV episode or movie where people on planet only live a hundred days and fall asleep at prescribed time Can a free radical be created by chemical reaction of non-radical species? This is explained here You can use arithmetic expressions in if, so you don't have to use [ ] or [[ ]] at all in some cases. Resubmitting elsewhere without any key change when a paper is rejected Most useful knowledge from the 30's to understand current state of computers & networking?

For the shell to recognize the then as a token it needs to standing in a line on its own or be separated by a ;. Is the partition function of non-conformal theories on a torus modular invariant? Is it unethical to take a photograph of my question sheets from a sit-down exam I've just finished if I am not allowed to take them home? Unable to complete a task at work.

It should tell you that [ is an alias to test command, so [ ] in bash is not some special syntax for conditionals, it is just a command on its Browse other questions tagged shell shell-script oracle-database or ask your own question. Schengen visa to Norway to visit my wife refused Resubmitting elsewhere without any key change when a paper is rejected Lagrange multiplier on unit sphere Understanding the grammar: «illis Evangelii nuntiandi asked 1 year ago viewed 1169 times active 1 year ago Related 1-Bash command not found appearing every time I start terminal8xcodebuild firing after every terminal command1openAL Terminal ends with Error:

fi construct. split strings and add them as new row Why would Snape set his office password to 'Dumbledore'? I runned it online on http://www.compileonline.com/execute_bash_online.php it is working well but not on my system(Centos 6.2). printf ...

I could edit it out, but the damage has been done. bash share|improve this question asked Dec 14 '13 at 18:33 Calvin Koder 1661210 add a comment| 4 Answers 4 active oldest votes up vote 26 down vote accepted As well as Hit a curb today, taking a chunk out of the tire and some damage to the rim. 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

The reason for the spaces after [ is because [ is also not syntax. Tango Icons Tango Desktop Project. How to decrypt .lock files from ransomeware on Windows Why do the Avengers have bad radio discipline? How could I have modern computers without GUIs?