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

Syntax Error Near Unexpected Token Fi' Shell

Contents

This is explained here You can use arithmetic expressions in if, so you don't have to use [ ] or [[ ]] at all in some cases. Unix & Linux Stack Exchange works best with JavaScript enabled UbuntuCommunityAsk!DeveloperDesignDiscourseHardwareInsightsJujuShopMore ›AppsHelpForumLaunchpadMAASCanonical current community chat Ask Ubuntu Ask Ubuntu Meta your communities Sign up or log in to customize your list. You need to modify the file to remove those CR characters, a couple of ways of doing that are given in this excellent answer. How could I have modern computers without GUIs? http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-do-shell.html

I'll check it out when I get back to my desk. –Tony Sawah Aug 15 at 20:14 add a comment| Your Answer draft saved draft discarded Sign up or log will not do what you (probably) want, here. Join them; it only takes a minute: Sign up shell : syntax error near unexpected token `fi' up vote 0 down vote favorite Getting syntax error near unexpected token `fi' while I could edit it out, but the damage has been done.

Syntax Error Near Unexpected Token Fi' Mac

how to match everything between a string and before next space Can a free radical be created by chemical reaction of non-radical species? Another problem is that you didn't quote "$f" which might become a problem later. Not the answer you're looking for? share|improve this answer edited Oct 30 '11 at 13:15 answered Oct 30 '11 at 13:09 Riccardo Murri 10.9k53647 thank you Mr.Riccardo –Beginners Oct 30 '11 at 13:19 add a

Deep theorem with trivial proof How secure is a fingerprint sensor versus a standard password? Join them; it only takes a minute: Sign up Syntax error near unexpected token 'fi' in shell script sqlplus up vote 0 down vote favorite I'm having an issue here when else .. Syntax Error Near Unexpected Token `then' Dec 14 '13 at 19:15 I was only focusing on the syntax error in question, but fair point, I've edited the code to include these quotes. –jprice Dec 14

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 Syntax Error Near Unexpected Token Fi' In Unix 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 Remove them with dos2unix or a similar tool. –chepner Sep 16 '13 at 13:16 | show 2 more comments 2 Answers 2 active oldest votes up vote 2 down vote Answering What are some counter-intuitive results in mathematics that involve only finite objects?

Browse other questions tagged bash or ask your own question. Syntax Error Near Unexpected Token Else Is it a coincidence that the first 4 bytes of a PGP/GPG file are ellipsis, smile, female sign and a heart? Ubuntu Ubuntu Insights Planet Ubuntu Activity Page Please read before SSO login Advanced Search Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] shell script "syntax error near Join them; it only takes a minute: Sign up linux bash: line 18: syntax error near unexpected token `fi' Q2.sh: line 18: `fi' up vote 1 down vote favorite I'm trying

Syntax Error Near Unexpected Token Fi' In Unix

If you want TWO newlines to appear, then use echo -e 'start\n' or echo $'start\n' . This site is not affiliated with Linus Torvalds or The Open Group in any way. Syntax Error Near Unexpected Token Fi' Mac The following code is correct: if [ $# -eq 1 ] then echo ok fi Also, these brackets are not actually if condition brackets. Syntax Error Near Unexpected Token Fi' Cygwin The second is equivalent to your if statement.

share|improve this answer edited Mar 24 '15 at 6:39 answered Mar 24 '15 at 6:22 paxdiablo 499k1229851441 Used the suggested commands and it did not work. this content USER_TYPE=$1 #IDENTIFY USER TYPE TYPE1,TYPE2,TYPE3,TYPE4,TYPE5 USER_NAME=$2 TARGET_SCHEMA=$3 TARGET_TABLE=$4 PERMISSION_TYPE=$5 if $USER_TYPE == 'TYPE1'; then sqlplus / << E00 CREATE USER ${USER_NAME} IDENTIFIED BY "default" DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP ACCOUNT 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). Removing brace from the left of dcases Resubmitting elsewhere without any key change when a paper is rejected Why are terminal consoles still used? Syntax Error Near Unexpected Token For

If condition is any valid bash command, and brackets are equivalent to test, see man test for ref. Usually getent is preferred over direct manipulation of the /etc/passwd file. –tripleee May 22 '13 at 16:54 The second check already rules out any negative numbers, as you do share|improve this answer answered Jul 15 at 15:15 eugene y 58.6k14124214 This is a good read: Why are bash tests so picky about whitespace? –Jonny Henly Jul 15 at http://allconverter.net/syntax-error/syntax-error-near-unexpected-token-done-shell-script.html share|improve this answer answered Sep 16 '13 at 8:23 sshilovsky 340213 add a comment| up vote 1 down vote Works for me: $ cat > f.sh #!/bin/bash echo "print a message"

printf ... Syntax Error Near Unexpected Token `done' 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 I can only recreate the error you're citing by removing the space between the if and the [ character.

Lagrange multiplier on unit sphere 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

Same goes for the code that creates the directory. –chepner Jul 15 at 15:20 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote [ is a asked 3 years ago viewed 7445 times active 2 years ago Get the weekly newsletter! Does using documentation as a developer make me look unprofessional? Syntax Error Near Unexpected Token (' Bash Resubmitting elsewhere without any key change when a paper is rejected Why do the Avengers have bad radio discipline?

Tango Icons © Tango Desktop Project. default override of virtual destructor how to match everything between a string and before next space Idiomatic Expression that basically says "What's bad for you is good for me" Amplifier circuit I picked bash out of a hat as the question didn't specify. check over here So I am between giving this answer -1 or nothing at all... –Aleks-Daniel Jakimenko-A.

From the bash man page: "BUGS It's too big and too slow." –RobertL Dec 5 '15 at 6:23 | show 4 more comments Your Answer draft saved draft discarded Sign