I have a script where I pass some part of the file as parameter and also along with another parmater that says whether it's daily or monthly file. I check to see if the file is DLY then I get a NEW_DT from another file. After i get the NEW_DT I have to check if in the directory there are files with the name of the file I passed as parmater along with the NEW_DT. If the number of files are equal to 2 then I have to do futher processing. I am not getting where I am wrong. Please correct me.
Quote:
#!/bin/ksh
export FILENAME=$1
export FILETYPE=$2
export STG_LOG_DIR='/edwstage/Logs'
dev='/biddf/ab6498/dev/ctl'
cd $dev
if [ $2 = 'DLY' ]; then
export RUNDTFILE=audt_run_dt_dly.txt
else
export RUNDTFILE=audt_run_dt_mth.txt
fi
export OLD_DT=`grep OLD_DT $STG_LOG_DIR/$RUNDTFILE | cut -f2 -d':'`
export NEW_DT=`grep NEW_DT $STG_LOG_DIR/$RUNDTFILE | cut -f2 -d':'`
myfilepattern=$1
fullpattern=${myfilepattern}_???_$NEW_DT.dat
integer filecount=0
for file in $fullpattern ; do
[ "$file" = "$fullpattern" ] && filecount=$filecount+1
done
if (( $filecount == 2 )); then
print "success"
exit 0
else
print "failure"
exit 1
fi
|
I call the script this way