I have a script like this below. I am calling the script like this script1.ksh BARE01_DLY The script looks in the directory for named files BARE01_DLY_???_YYYYMMDD. The YYYYMMDD signify todays date when the script ran. It checks whether they are 10 files with that pattern for today and if they are then it shows succes otherwise failure. But in the directory I have only one file with name BARE01_DLY_MKT_20060720. But after I run the script in debug mode the output shows like it has 2 files with that name. Please see belwo for output.
myfilepattern=BARE01_DLY
+ typeset -i filecount=0
+ filecount=0+1
+ filecount=1+1
+ let 2 == 10
+ print failure
failure
+ exit 1
Here it shows 2==10 but I have only one file for that day. So where am i going wrong. Please suggest. Below is the script.
Code:
#!/bin/ksh
dir=/biddf/ab6498/dev/ctl
export dir
set -x
myfilepattern=$@
integer filecount=0
for file in $myfilepattern_???_date +%Y%m%d ; do
filecount=$filecount+1
done
if (( $filecount == 10 )); then
print "success"
exit 0
else
print "failure"
exit 1
fi