Syntax Error in Script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Syntax Error in Script
# 1  
Old 08-08-2011
Data Syntax Error in Script

Hi All,

I am new to Unix, I have written the following script in ksh and get a syntax error Smilie. I need some help to figure out the error and reason. The script below uses some variables from an environment file, also it executes a sql file. The sql file is correct and has no problems. I need some help in Identifying the syntactical error in the script. I have pasted the output after the script.

Code:
#!/bin/ksh
 #*********************************************************************************
 #DAMA202.ksh Notification When XX Not Processing
 #*********************************************************************************
 #

#*********************************************************************************
 #source in AMR function library
 . $HOME"/scripts/amrksh.lib"
  
 startjob_amr $0
  
 #*******************************************************************************
 #*STEP0  Get file name for log file
 #*******************************************************************************
  
 startstep_amr STEP0
 AMA202L11=$(amr_get_file_gen_name AMA202L1)   #Log file
 if (($? != 0))
    then
    ppllog "amr_get_file_gen_name failed"
    exit 1
 fi
  
 #*******************************************************************************
 #*STEP1  Run the check processing script in a loop.  If the query finds no 
 #*       processing, send an e-mail.
 #*******************************************************************************
  
 startstep_amr STEP1
 lasttime_warn=0
 integer time_count=0
 while (($time_count < $DAMA202_TIME_COUNT))
   do
  
    WINDOW_OPEN=$(in_TNSP_maintenance_window)  
    if [[ "$WINDOW_OPEN" = "Y" ]]
    then
      ppllog "TNSP Batch Window is open-skipping-"$0
      sleep ${DAMA202_SLEEP_TIME}
    else
  
  
       sqlplus $USER/$PASSWORD@$ORACLE_SID\
        @${AMR_SCRIPTS_PATH}DAMA202.sql ${AMA202L11} ${DAMA202_SLEEP_TIME}
  
       RC=$?
  
       mv ${AMA202L11}.lst ${AMA202L11}
       if (($? != 0))
       then
          ppllog "SQL file rename failed"
          exit 10
       fi
  
  
       if (($RC != 0))
       then
          if (($RC == 1))
          then
             if (($lasttime_warn == 0))
             then
                cat ${AMA202L11} | mailx -s "DCSI is not processing" ${DAMA202_EMAIL}
             else
                cat ${AMA202L11} | mailx -s "CRITICAL - DCSI is not processing" ${DAMA202_EMAIL_PAGE}
             fi
          else
             ppllog "Check for DCSI not processing failed"
             exit 11
          fi
       fi
       lasttime_warn=$RC         
    fi
  
    time_count=`expr $time_count + 1`
  
 #*********************************************************************************
 # #6 Exit script successfully if time is between 5:30 AM and 6 AM
 #*********************************************************************************                       
    NOW=$(date +%0H%0M)
    if (( $NOW > 529 ))
    then if (( $NOW < 601))
         then endjob_amr $0
         fi
    fi
 done
  
 #*********************************************************************************
 #Normal Termination
 #*********************************************************************************
 endjob_amr $0

Output:
--------------
Code:
Using default environment file
  
 SQL*Plus: Release 9.2.0.8.0 - Production on Mon Aug 8 15:00:52 2011
  
 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
  
  
 Connected to:
 Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
 JServer Release 9.2.0.8.0 - Production
  
 Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Producti
 on
 JServer Release 9.2.0.8.0 - Production
  
 expr: Syntax error
  
  
 SQL*Plus: Release 9.2.0.8.0 - Production on Mon Aug 8 15:01:53 2011
  
 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
  
  
 Connected to:
 Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
 JServer Release 9.2.0.8.0 - Production
  
 Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Producti
 on
 JServer Release 9.2.0.8.0 - Production
 0
 ./DAMA202.ksh[72]: 1:  not found
  
 SQL*Plus: Release 9.2.0.8.0 - Production on Mon Aug 8 15:02:54 2011
  
 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
  
  
 Connected to:
 Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
 JServer Release 9.2.0.8.0 - Production
  
 Disconnected from Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Producti
 on
 JServer Release 9.2.0.8.0 - Production
 0
 ./DAMA202.ksh[72]: 1:  not found


Last edited by Scott; 08-09-2011 at 03:00 AM.. Reason: Please use code tags
# 2  
Old 08-08-2011
It seems to be having trouble with time_count=`expr $time_count + 1`, but that seems to work with my ksh fine.

Why not try:
Code:
let time_count=time_count+1

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Syntax error on script

Evening All (or morning for some), Could anyone have a look at the below and advise where i've going wrong with the syntax as i keep getting the below error while trying to run. Any help would be really apprecaited. ./testout: line 13: syntax error near unexpected token `else' ... (4 Replies)
Discussion started by: mutley2202
4 Replies

2. Shell Programming and Scripting

First Script Syntax Error

So, I'm writing my first shell script to try to speed up the process of creating lyric files for mocp and I don't know what the error is, but considering how short the code is, I'm betting it's something super-obvious. line 7: syntax error near unexpected token `echo' line 7: ` echo... (4 Replies)
Discussion started by: D351
4 Replies

3. UNIX for Dummies Questions & Answers

Syntax Error Script

Hi guys i'd like to show you this code of my script, where i couldn't find this error " #! /bin/bash #copiabin.sh: copia todos los archivos ejecutables a bin if then mkdir $HOME/bin fi # copia de archivos y contador N N=0 for ARCH in * do if # Si el archivo es... (9 Replies)
Discussion started by: Newer
9 Replies

4. Shell Programming and Scripting

Syntax error calling TCL script from shell script

hello everyone i am beginner on shell scripting .and i am working on my project work on ad hoc network i wrote a batch (.sh) to do a looping and execute a tcl script i wrote before in each iteration ..but i got this problem " syntax error near unexpected token `('... (1 Reply)
Discussion started by: marcoss90
1 Replies

5. Shell Programming and Scripting

Syntax error in script

Hey guys keep having problems with the below script syntax error near unpexpected token '0' exit 0 I have two directorys backups and Usr in the usr i have sub dir's wp,ss,pic which i would like to back up (copy those directorys to the backups directory) with user acknowledgement from command line.... (2 Replies)
Discussion started by: Spartukus
2 Replies

6. Shell Programming and Scripting

Syntax error with a script

Hi I not sure what is wrong with my script... when I try to run it I get the follow error: "remove: syntax error at line 77: `end of file' unexpected" Thanks in advance for any help. ans=y while do while : do echo "Please enter a name that you... (3 Replies)
Discussion started by: simpsonjr
3 Replies

7. UNIX for Dummies Questions & Answers

awk Shell Script error : "Syntax Error : `Split' unexpected

hi there i write one awk script file in shell programing the code is related to dd/mm/yy to month, day year format but i get an error please can anybody help me out in this problem ?????? i give my code here including error awk ` # date-month -- convert mm/dd/yy to month day,... (2 Replies)
Discussion started by: Herry
2 Replies

8. Shell Programming and Scripting

Syntax error in script

I get this error when I try to run my script (BTW, this is a simple script I am supposed to write for my class) $ menuscript menuscript: syntax error at line 89 : `"' unmatched $ Here is the code (Any help is greatly appreciated) (Line numbers included) 1 #!/bin/ksh 2 ... (2 Replies)
Discussion started by: KindHead
2 Replies

9. Shell Programming and Scripting

syntax error in script !!

./disk_space_util.sh ./disk_space_util.sh: Syntax error at line 24 : `then' is not expected. ================================= cat disk_space_util.sh #!/bin/sh # # Parameter Settings ORA_LOG, ORA_SCRIPT, DBA_EMAIL_LIST -- (Set in .profile) bdf | sed "s/%/ /g" | sed "/Filesystem/d" |... (13 Replies)
Discussion started by: uuser
13 Replies

10. Shell Programming and Scripting

Syntax error in a script...

Hi All, I have been fighting with a syntax error for the last 2 days, still haven't got the solution. Could you please help me, your help will be greatly appreciated. In my script I am getting a error in a for loop, its similar to the one as is below. for v_id in v1 v2 v3 v4 do... (8 Replies)
Discussion started by: rajus19
8 Replies
Login or Register to Ask a Question