944,070 Members | Top Members by Rank

Ad:
Oct 9th, 2009
0

This is the error i get when i run my script: Unmatched `

Expand Post »
Hi,
can anyone please help me on this.
I dont understand as to why am getting this error..

Please, please help on this!

fortesting purpose I have commented certain lines..


Shell Scripting Syntax (Toggle Plain Text)
  1. "Pre_s2a_leadtime.sh" 55 lines, 1233 characters
  2. #!/bin/csh
  3.  
  4. # Check if program is already running and echo a time stamp for the log file
  5. #log_start_chk $0 $$
  6. #if ( $status == 0 ) then
  7. #exit
  8. #endif
  9.  
  10. #source run_env
  11.  
  12. set L2S_RUN_LOG_FILE="Pre_s2a_leadtime.log"
  13.  
  14. echo -n "$0 started" >> ${L2S_RUN_LOG_FILE}
  15. date '+%m%d%y %H:%M:%S' >> ${L2S_RUN_LOG_FILE}
  16.  
  17.  
  18. #setenv DB_NAME viewer/viewer@ltstprod
  19.  
  20.  
  21. FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND >> ${L2S_RUN_LOG_FILE}
  22. set pagesize 0 feedback off verify off heading off echo off
  23. select UNCONSTRAINED_PIECE_PART from ICMPINPUTCONTROL;
  24. exit;
  25. SQLEND`
  26.  
  27. if [ $FLAG ='Y']
  28. then
  29.  
  30. sqlplus viewer/viewer@ltstprod << sqlend >> ${L2S_RUN_LOG_FILE}
  31. # Running the following queries before the actual L2S program
  32.  
  33. drop table cycle_time_bkp;
  34.  
  35. create table cycle_time_bkp as select * from cycle_time;
  36.  
  37. update cycle_time a set cycle_time_days = 0
  38. where exists(select 1 from route b where a.id = b.id and a.route = b.route and b.flow_id = 7);
  39.  
  40. quit
  41. "Pre_s2a_leadtime.sh" 55 lines, 1256 characters
Similar Threads
Reputation Points: 9
Solved Threads: 0
Junior Poster in Training
naziatarannum is offline Offline
51 posts
since Jul 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
Line 21 of your original post is missing a `:
Shell Scripting Syntax (Toggle Plain Text)
  1. FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND >> ${L2S_RUN_LOG_FILE}
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
Hi sknake,
thanks a lot for hte quick response.

I already have ` symbol at he end of second SQLEND
at line 25 of my initial code tag

for your ref..

Shell Scripting Syntax (Toggle Plain Text)
  1. FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND >> ${L2S_RUN_LOG_FILE}set pagesize 0 feedback off verify off heading off echo offselect UNCONSTRAINED_PIECE_PART from ICMPINPUTCONTROL;exit;SQLEND`
Reputation Points: 9
Solved Threads: 0
Junior Poster in Training
naziatarannum is offline Offline
51 posts
since Jul 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
I missed that. You need to instruct CSH that the command is split over multiple lines:
Shell Scripting Syntax (Toggle Plain Text)
  1. FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND >> ${L2S_RUN_LOG_FILE} \
  2. set pagesize 0 feedback off verify off heading off echo off \
  3. select UNCONSTRAINED_PIECE_PART from ICMPINPUTCONTROL; \
  4. exit; \
  5. SQLEND`
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
Thank you very much Scott, it worked! (but without spaces before \ symbol).

Thanks once again.

now Am stuck with another error in my code. Though the values in table column in Y, I get this error. The if condition is supposed to be true.
Error is:
[Y=Y]: No match


Shell Scripting Syntax (Toggle Plain Text)
  1. "Pre_s2a_leadtime.sh" 54 lines, 1243 characters
  2. #!/bin/csh
  3.  
  4. # Check if program is already running and echo a time stamp for the log file
  5. #log_start_chk $0 $$
  6. #if ( $status == 0 ) then
  7. #exit
  8. #endif
  9.  
  10. #source run_env
  11.  
  12. set L2S_RUN_LOG_FILE="Pre_s2a_leadtime.log"
  13.  
  14. echo -n "$0 started" >> ${L2S_RUN_LOG_FILE}
  15. date '+%m%d%y %H:%M:%S' >> ${L2S_RUN_LOG_FILE}
  16.  
  17.  
  18. #setenv DB_NAME viewer/viewer@ltstprod
  19.  
  20.  
  21. set FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND\
  22. set pagesize 0 feedback off verify off heading off echo off\
  23. select unconstrained_piece_part from icmpinputcontrol;\
  24. exit;\
  25. SQLEND`
  26.  
  27. if [$FLAG='Y'] then
  28.  
  29. sqlplus viewer/viewer@ltstprod << sqlend >> ${L2S_RUN_LOG_FILE}
  30. # Running the following queries before the actual L2S program
  31.  
  32. drop table cycle_time_bkp;
  33.  
  34. create table cycle_time_bkp as select * from cycle_time;
  35.  
  36. update cycle_time a set cycle_time_days = 0
  37. where exists(select 1 from route b where a.id = b.id and a.route = b.route and b.flow_id = 7);
  38. commit;
  39. quit
  40. sqlend
  41. "Pre_s2a_leadtime.sh" 54 lines, 1243 characters
Reputation Points: 9
Solved Threads: 0
Junior Poster in Training
naziatarannum is offline Offline
51 posts
since Jul 2009
Oct 9th, 2009
1
Re: This is the error i get when i run my script: Unmatched `
Change the format of your if statement:
Shell Scripting Syntax (Toggle Plain Text)
  1. sk:/tmp> set FLAG="Y"
  2. sk:/tmp> echo $FLAG
  3. Y
  4. sk:/tmp> if ( ${FLAG} == Y ) echo "hi"
  5. hi
  6. sk:/tmp> if ( ${FLAG} == N ) echo "hi"
  7. sk:/tmp>
Last edited by sknake; Oct 9th, 2009 at 4:56 am.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
Thanks a lot Scott!
it worked..

one more thing, am I connecting to sql more than once. but i use sqlend eachtime. am getting a message saying script FAILED at the end, though all sql stmts are executing completely.

Can you advise why is this?

My log file output is as below

Shell Scripting Syntax (Toggle Plain Text)
  1. Pre_s2a_leadtime.sh started100909 02:51:37
  2.  
  3. SQL*Plus: Release 9.2.0.3.0 - Production on Fri Oct 9 02:51:37 2009
  4.  
  5. Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
  6.  
  7.  
  8. Connected to:
  9. Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
  10. With the Partitioning, OLAP and Oracle Data Mining options
  11. JServer Release 9.2.0.3.0 - Production
  12.  
  13. SQL> SP2-0734: unknown command beginning "Running th..." - rest of line ignored.
  14. SQL> SQL>
  15. Table dropped.
  16.  
  17. SQL> SQL>
  18. Table created.
  19.  
  20. SQL> SQL> 2
  21. 649 rows updated.
  22.  
  23. SQL>
  24. Commit complete.
  25.  
  26. SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Produc tion
  27. With the Partitioning, OLAP and Oracle Data Mining options
  28. JServer Release 9.2.0.3.0 - Production
  29. Pre_s2a_leadtime.sh has FAILED
Reputation Points: 9
Solved Threads: 0
Junior Poster in Training
naziatarannum is offline Offline
51 posts
since Jul 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
I don't know. What is throwing the error -- the oracle client or the script? I'm not that familiar with csh or oracle. Sorry I couldn't be of any help on this one. You do have a comment in the middle of your SQL Statement though -- Maybe that is causing it to report the failure:
"Pre_s2a_leadtime.sh" 54 lines, 1243 characters
#!/bin/csh

# Check if program is already running and echo a time stamp for the log file
#log_start_chk $0 $$
#if ( $status == 0 ) then
#exit
#endif

#source run_env

set L2S_RUN_LOG_FILE="Pre_s2a_leadtime.log"

echo -n "$0 started" >> ${L2S_RUN_LOG_FILE}
date '+%m%d%y %H:%M:%S' >>  ${L2S_RUN_LOG_FILE}


#setenv DB_NAME viewer/viewer@ltstprod


set FLAG=`sqlplus -silent viewer/viewer@ltstprod << SQLEND\
set pagesize 0 feedback off verify off heading off echo off\
select unconstrained_piece_part from icmpinputcontrol;\
exit;\
SQLEND`

if [$FLAG='Y'] then

sqlplus viewer/viewer@ltstprod << sqlend >> ${L2S_RUN_LOG_FILE}
# Running the following queries before the actual L2S program
drop table cycle_time_bkp;

create table cycle_time_bkp as select * from cycle_time;

update cycle_time a set cycle_time_days = 0
where exists(select 1 from route b where a.id = b.id and a.route = b.route and b.flow_id = 7);
commit;
quit
sqlend
"Pre_s2a_leadtime.sh" 54 lines, 1243 characters

At that point it isn't interpreting that line as shellscript but rather piping the contents to a file which is evident in:
SQL> SP2-0734: unknown command beginning "Running th..." - rest of line ignored.
SQL> SQL>
Table dropped.

Move that comment above the >>file and see if that cures your issue
Last edited by sknake; Oct 9th, 2009 at 8:25 am.
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Oct 9th, 2009
0
Re: This is the error i get when i run my script: Unmatched `
THANKS!
Reputation Points: 9
Solved Threads: 0
Junior Poster in Training
naziatarannum is offline Offline
51 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Can somebody help with looping my command?
Next Thread in Shell Scripting Forum Timeline: Getting script to run on boot up in linux





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC