Error in KSH Script

5 pts.
Tags:
Korn Shell
KSH
I'm getting this error in my KSH Script, I cna not see there error HELP!!! 2008-02-04 11:12:46 516 Job started 2008-02-04 11:12:46 611 Step 001 started 2008-02-04 11:12:46 612 External program: /home/erpmm/Q2S_scripts/Log_MQ_trim_file.sh 2008-02-04 11:12:46 613 Related parameter: Q2S 2008-02-04 11:12:46 606 Ext. prog.: /home/erpmm/Q2S_scripts/Log_MQ_trim_file.sh[31]: syntax error at line 31 : ``' unmatched 2008-02-04 11:12:46 606 Ext. prog.: External program terminated with exit code 2 2008-02-04 11:12:46 614 External program was cancelled 2008-02-04 11:12:46 608 Job status was manually set to 'cancelled' Completed at 2/4/2008 11:12:54 AM #!/usr/bin/ksh # # Directory: # # Filename: trim_file # # Purpose: Trim a file to a specified number of lines. # # Usage: $ trim_file <file> <number_of_lines> # # Parameter Definitions: # $1: file # $2: number of lines to retain # # Author: # # Changes: # # ---------------------------------------------------------------------- # *** Copyright 1997 United Technologies Corporation. # All Rights reserved. # This program contains proprietary and trade secret information of # United Technologies Corporation. Copyright notice is # precautionary only and does not imply publication. # ---------------------------------------------------------------------- # # *** Start of function # # syntax error at line 31 : ``' unmatch #set $1=/pw/data/erp/Q2S/qm/down/qme001_nabearing_rework_order.dat #set $2=1000 set -x function trim_file { print "" print '*** trim_file started at '"$(date)..." if [[ $# = 2 ]] then file_nm=$1 typeset -i file_ln=$2 if [[ -w $file_nm ]] then tmp_file=/tmp/trim.$$ print "" print " File listing, by date, ls -lt follows:" ls -lt $file_nm tail -$file_ln $file_nm > $tmp_file if [[ $? = 0 ]] then cp $tmp_file $file_nm print "" print " File listing, by date, ls -lt follows:" ls -lt $file_nm rm $tmp_file else print "" print " File ${file_nm} trim failed." fi else print "" print " File ${file_nm} does not exist or is not writable." fi else print "" print " Usage: trim_file <file> <number_of_lines_to_retain>" fi print "" print '*** trim_file ends at '"$(date)..." } cd /pw/data/erp/Q2S/qm/down/ trim_file qme001_nabearing_rework_order.dat 1000
ASKED: February 4, 2008  4:52 PM
UPDATED: February 4, 2008  5:13 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following