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

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2009
Posts: 47
Reputation: naziatarannum is an unknown quantity at this point 
Solved Threads: 0
naziatarannum's Avatar
naziatarannum naziatarannum is offline Offline
Light Poster

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

 
0
  #1
Oct 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,437
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 624
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #2
Oct 9th, 2009
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}
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 47
Reputation: naziatarannum is an unknown quantity at this point 
Solved Threads: 0
naziatarannum's Avatar
naziatarannum naziatarannum is offline Offline
Light Poster
 
0
  #3
Oct 9th, 2009
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`
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,437
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 624
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #4
Oct 9th, 2009
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`
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 47
Reputation: naziatarannum is an unknown quantity at this point 
Solved Threads: 0
naziatarannum's Avatar
naziatarannum naziatarannum is offline Offline
Light Poster
 
0
  #5
Oct 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,437
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 624
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
1
  #6
Oct 9th, 2009
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.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 47
Reputation: naziatarannum is an unknown quantity at this point 
Solved Threads: 0
naziatarannum's Avatar
naziatarannum naziatarannum is offline Offline
Light Poster
 
0
  #7
Oct 9th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,437
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 624
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast
 
0
  #8
Oct 9th, 2009
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.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 47
Reputation: naziatarannum is an unknown quantity at this point 
Solved Threads: 0
naziatarannum's Avatar
naziatarannum naziatarannum is offline Offline
Light Poster
 
0
  #9
Oct 9th, 2009
THANKS!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum


Views: 752 | Replies: 8
Thread Tools Search this Thread



Tag cloud for Shell Scripting
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC