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

Syntax Error Near Unexpected Token Fi' Cygwin

Contents

Unable to complete a task at work. Not the answer you're looking for? If condition is any valid bash command, and brackets are equivalent to test, see man test for ref. But there is another problem, $(( … )) tries to execute "fname % 2", and this is not what you want. http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-done-cygwin.html

This is explained here You can use arithmetic expressions in if, so you don't have to use [ ] or [[ ]] at all in some cases. Understanding the grammar: «illis Evangelii nuntiandi praebens mandatum» Does using documentation as a developer make me look unprofessional? 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 It is common and well known since the beginning of Oracle database. –user75ponic Aug 23 '13 at 6:36 @Polppan : oh, thanks for that info ^^ –Olivier Dulac Aug

Syntax Error Near Unexpected Token Fi Mac

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 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 Code #!/bin/bash echo "print a message" if [ $# -eq 1 ]; then echo "Argument are passed to shell script" else echo "No arguments are passed to shell script" fi Error

There must be a space between [[ and first operator. current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. 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? Syntax Error Near Unexpected Token `done' This site is not affiliated with Linus Torvalds or The Open Group in any way.

You would have had the same error message by entering that ; alone on the command line. ; must be used to separate commands, it cannot be used on its own Syntax Error Near Unexpected Token For Still I don't like your if expression, there's no point to use test command there. Close current window shortcut Removing brace from the left of dcases Letter of Recommendation Without Contact from the Student more hot questions about us tour help blog chat data legal privacy 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.

To me it seems to be character encoding issue. Syntax Error Near Unexpected Token (' Bash Browse other questions tagged bash or ask your own question. Can a creature with 0 power attack? How secure is a fingerprint sensor versus a standard password?

Syntax Error Near Unexpected Token For

UNIX is a registered trademark of The Open Group. Eating Skittles Like a Normal Person How to construct a 3D 10-sided Die (Pentagonal trapezohedron) and Spin to a face? Syntax Error Near Unexpected Token Fi Mac What you are running into are syntax problems. Syntax Error Near Unexpected Token `then' if test $# -eq 1 ; then ...

Not the answer you're looking for? this content 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. 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. Why do the Avengers have bad radio discipline? Syntax Error Near Unexpected Token Else

jambesh Shell Programming and Scripting 1 12-06-2007 09:56 PM A beginner for cygwin simple question zhshqzyc UNIX for Dummies Questions & Answers 1 08-06-2007 03:27 PM All times are GMT -4. 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 So I am between giving this answer -1 or nothing at all... –Aleks-Daniel Jakimenko-A. weblink 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

It is of the form: if cmd args In this case, cmd is derived from the expansion of the [1==2] glob. [1==2] is a globbing pattern that expands to the list Syntax Error: Unexpected End Of File asked 3 years ago viewed 7445 times active 2 years ago Visit Chat Related 0Bash script error. Am I doing >anything wrong? >"If" also doesn't work.

sh/ksh/bash/ash all sort of have a similar look/feel.

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 properly localize numbers? default override of virtual destructor How can I stun or hold the whole party? Unexpected End Of File Bash default override of virtual destructor Is there a performance difference in the 2 temp table initializations?

if doesn't use parens, it uses square brackets. Positivity of certain Fourier transform Display a Digital Clock default override of virtual destructor Disease that requires regular medicine Add a language to a polyglot split strings and add them as Top Log in or register to post comments Like Leave this field blank Click Here! http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-fi-mac.html 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:

Sign up for Fantasy Football >http://football.fantasysports.yahoo.com >-- >Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >Problem reports: http://cygwin.com/problems.html >Documentation: http://cygwin.com/docs.html >FAQ: http://cygwin.com/faq/ -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ References: Problem with It is a simple command.