I found two problem in your script
$myfilepattern_???_$(date +%Y%m%d) is interpreted by the shell as ${myfilepattern_}???_$(date +%Y%m%d).
You must code like this : $
{myfilepattern
}_???_$(date +%Y%m%d)
The for statement returns the pattern itself if no file are found.
You must test for that pattern.
Code:
#!/bin/ksh
dir=/biddf/ab6498/dev/ctl
export dir
set -x
myfilepattern=$@
fullpattern=${my_filepattern}_???_$(date +%Y%m%d)
integer filecount=0
for file in $fullpattern ; do
[ "$file" != "$fullpattern"] && filecount=$filecount+1
done
if (( $filecount == 10 )); then
print "success"
exit 0
else
print "failure"
exit 1
fi
Jean-Pierre.