Oracle Syntax Error Near Unexpected Token
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta syntax error near unexpected token fi' shell script Discuss the workings and policies of this site About Us Learn more syntax error near unexpected token else' in shell script about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Unix unexpected token else bash & Linux Questions Tags Users Badges Unanswered Ask Question _ Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating
Syntax Error Near Unexpected Token For
systems. 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 top Shell Script - syntax error near unexpected token `else' up vote 4 down vote favorite With the following shell script, why I am getting errors syntax bash syntax error near error near unexpected token `else' Shell Script echo "please enter username" read user_name echo "please enter password" read -s pass echo ${ORACLE_SID} SID=${ORACLE_SID} if ["${ORACLE_SID}" != 'Test'] then sqlplus -s -l $USER_NAME/$PASS@$SID < here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies syntax error near unexpected token then' bash of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a http://unix.stackexchange.com/questions/87776/shell-script-syntax-error-near-unexpected-token-else minute: Sign up Syntax error near unexpected token 'fi' up vote 19 down vote favorite 2 I'm trying to write a script that removes all the .jpg's that end in an odd number. 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 ] http://stackoverflow.com/questions/20586785/syntax-error-near-unexpected-token-fi then echo "removing $fname\n" rm $f fi done When I run it it outputs start and then says "syntax error near unexpected token 'fi'" When I had then on the line after if it said "syntax error near unexpected token 'then'" How do i fix this? bash share|improve this question asked Dec 14 '13 at 18:33 Calvin Koder 1561210 add a comment| 4 Answers 4 active oldest votes up vote 26 down vote accepted As well as having then on a new line, you also need a space before and after the [, which is a special symbol in BASH. #!/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 "removing $fname\n" rm "$f" fi done share|improve this answer edited Dec 14 '13 at 19:17 answered Dec 14 '13 at 18:43 jprice 6,92111025 1 Its still giving me "syntax error near unexpected token 'then'" –Calvin Koder Dec 14 '13 at 18:54 The code I've posted runs without any errors on my CommunityOracle User Group CommunityTopliners CommunityOTN Speaker BureauJava CommunityError: You don't have JavaScript enabled. This tool uses JavaScript and much of it will not work correctly without it enabled. Please turn JavaScript back on and reload this page. Please https://community.oracle.com/thread/631632 enter a title. You can not post a blank message. Please type http://www.dba-village.com/village/dvp_forum.OpenThread?ThreadIdA=57601 your message and try again. More discussions in General Database Discussions All PlacesDatabaseGeneral Database Discussions This discussion is archived 6 Replies Latest reply on Mar 13, 2008 11:39 AM by 628263 QUESTION ABOUT SQL LOADER 628263 Mar 13, 2008 9:45 AM Hi I followed tut about sql loader and syntax error I use it like this: sqlldr user/pass@db control=gnis log=gnis_michigan data=mi_deci can I use something like this? sqlldr "user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=X.X.X.X)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=sname))) control=gnis log=gnis_michigan data=mi_deci" Now i'm getting error" LRM-00116: syntax error at 'ADDRESS' following '(' Ralph 4003Views Tags: none (add) This content has been marked as final. Show 6 replies 1. Re: QUESTION ABOUT SQL LOADER 153119 Mar 13, 2008 9:50 AM (in syntax error near response to 628263) You have only 1 parameter embedded between double quotes. Why do you expect this works? Also you need to -set up a tnsnames.ora - find out the commandline continuation character for your shell -- Sybrand Bakker Senior Oracle DBA Like Show 0 Likes(0) Actions 2. Re: QUESTION ABOUT SQL LOADER 628263 Mar 13, 2008 10:00 AM (in response to 153119) Thanks for reply so fast Could You show me where I should place quotes? Like Show 0 Likes(0) Actions 3. Re: QUESTION ABOUT SQL LOADER 153119 Mar 13, 2008 10:04 AM (in response to 628263) Apparently you don't want to follow up my valid advice. If you would have followed my advice, you wouldn't have needed the quotes. Also: there should be no quotes, you should find out the commandline continuation character for your command shell. As you can't be bothered to post any specifics, no help is possible. You are heading in the wrong direction by ignoring my advice, so you are on your own. -- Sybrand Bakker Senior Oracle DBA Like Show 0 Likes(0) Actions Web and Mobile SQL*Plus Data Warehousing Installation Networking Backup Recovery Security Tuning PLSQL Oracle Applications Scripts Administration ORA-HOWTO Web and Mobile SQL*Plus Data Warehousing Installation Networking Backup Recovery Security Tuning PLSQL Oracle Applications Papers Administration ORA-HOWTO Web and Mobile SQL*Plus Data Warehousing Installation Networking Backup Recovery Security Tuning PLSQL Oracle Applications Forum All threads Best last month Links Oracle official Oracle Technical Info Tools (free) Tools (commercial) Oracle FAQ Other DBA-sites Oracle development Not Oracle specific Oracle Blogs Imho Fqa Pirats | Start a new thread | All threads | Best last month | Question Most of my databases are on version 12.1 11.2 11.1 10.2 10.1 or lower Answer and see the results DBA Top 10 1 M. Cadot 35800 2 F. Diaz 34000 3 J. Schnackenberg 16400 4 B. Vroman 15450 5 A. Kavsek 15250 6 P. Wisse 14250 7 T. Boles 13500 8 M. Hidayathullah ... 10900 9 A. Hudspith 9200 10 A. Khan 4100 About Advertise here Download PLATOThe free tool for auditing and tuning your databaseVersion 55 now available Sep 02, 2016 The DBA-Village forum as RSS feed Site StatisticsEver registered users47788Total active users2117Act. users last 24h9Act. users last hour1Registered user hits last week756Registered user hits last month6432 Go up impdp QUERY ..... -bash: syntax error near unexpected token `(' Next thread: export and import Prev thread: BASH command Message Score Author Date Hi Professionals, On Solaris 10, while using qu...... imran raza Dec 04, 2012, 19:07 Syntax Error Near Unexpected Token If
Syntax Error Near Unexpected Token In Shell Script
Protect the "(" with "\": "\(". Same thing...... Michel Cadot Dec 04, 2012, 19:15 Hi Michel, Apologies for being lazy, perhaps yo...... BenBart BartBen Dec 04, 2012, 22:46 Hi, Use a PAR file, and you may be lucky not to...... BenBart BartBen Dec 05, 2012, 02:34 Hi, And it works alright with the IMPDP as wel