Error in KSH Script
5 pts.
0
Q:
Error in KSH Script
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: Feb 4 2008  4:52 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
5 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Last Answered: Feb 4 2008  4:52 PM GMT by Rich144   5 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0