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

Syntax Error Near Unexpected Token Fi Mac

Contents

Will majority of population dismiss a video of fight between two supernatural beings? If you want TWO newlines to appear, then use echo -e 'start\n' or echo $'start\n' . What do you do with all the bodies? vBulletin 2000 - 2016, Jelsoft Enterprises Ltd. his comment is here

Need a way for Earth not to detect an extrasolar civilization that has radio Did millions of illegal immigrants vote in the 2016 USA election? 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 After my while loop stubbornly refused to work, I decided to simplify it to make sure I could get aa basic "if statement" to work, but for some reason after hours Make sure all the spaces I've described are in place. –jprice Dec 14 '13 at 18:59 You have forgot to quote "$f" –Aleks-Daniel Jakimenko-A.

Syntax Error Near Unexpected Token Fi Mac

Browse other questions tagged bash shell or ask your own question. What are some counter-intuitive results in mathematics that involve only finite objects? Thanks so much!

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 The second is equivalent to your if statement. Hot Network Questions Disease that requires regular medicine Difficulties interpreting this complex sentence Feynman diagram and uncertainty Word that includes "food, alcoholic drinks, and non-alcoholic drinks"? Syntax Error Near Unexpected Token Else' Join them; it only takes a minute: Sign up syntax error near unexpected token `fi' while checking no of arguments passed up vote 2 down vote favorite I am new to

To me it seems to be character encoding issue. Syntax Error Near Unexpected Token Fi' Cygwin This site is not affiliated with Linus Torvalds or The Open Group in any way. Any help is appreciated Thanks #!bin/bash numero=$1 if test $# -eq 0; then echo "Argument Manquants" exit 1 fi if ! [[ "$numero" =~ ^[0-9]+$ ]] ; then exec >&2; echo asked 2 years ago viewed 45487 times active 2 years ago Related 1bash - syntax error near unexpected token `<'4Confusing syntax error near unexpected token 'done'2Bash syntax error when commented out

This common pitfall is greatly explained here and here. Syntax Error Near Unexpected Token `done' I just realized that my encoding in Notepad++ had somehow gotten changed to "Windows/Dos" instead of "UNIX". How to reward good players, in order to teach other players by example Amplifier circuit woe Aligning texts side by side with equations in \align environment Plus and Times, Ones and May be it helps a bit.

Syntax Error Near Unexpected Token Fi' Cygwin

To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will 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 Is there any financial benefit to being paid bi-weekly over monthly? Syntax Error Near Unexpected Token For 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.

thanks in advance... this content Why are terminal consoles still used? This site is not affiliated with Linus Torvalds or The Open Group in any way. 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 `then'

TV episode or movie where people on planet only live a hundred days and fall asleep at prescribed time Why would a NES game use an undocumented 1-byte or 2-byte NOP What are the ground and flight requirements for high performance endorsement? Syntactically, then should go to a separate line. weblink 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

Try replacing that block for this: if [[ $numero -le 0 ]]; then echo "Le parametre doit etre plus grand que 0" exit 1 fi share|improve this answer answered May 22 Syntax Error Near Unexpected Token (' Bash 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 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.

Will majority of population dismiss a video of fight between two supernatural beings?

How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? In 5e, do you get to use the extra attack as well when you ready an attack action? Will majority of population dismiss a video of fight between two supernatural beings? Syntax Error: Unexpected End Of File Why is bench pressing your bodyweight harder than doing a pushup?

How to properly localize numbers? fi construct. After fixing most of the problems I'm left with this output: /media/satahd/media/test.sh: line 21: syntax error near unexpected token `fi' /media/satahd/media/test.sh: line 21: `fi' here's the script: #!/bin/bash ###root symlink folder: check over here What are the ground and flight requirements for high performance endorsement?

How to write an effective but very gentle reminder email to supervisor to check the Manuscript? Browse other questions tagged shell-script or ask your own question. 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 Is it still safe to drive?

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: Bounce off the atmosphere at reentry? Binary to decimal converter What do you do with all the bodies? measurable linear functionals are also continuous on separable Banach spaces?

What are the downsides to multi-classing?