Tente isso
#redirect stderr to null
exec 2> /dev/null
FILECOUNT = 'find *.log -mtime +1|wc -l'
#redirection of stderr to file
exec 2> /tmp/errors.txt
# gzip old log files
if [ $FILECOUNT != '0' ]; then
find *.log -mtime +1|xargs gzip -f
fi
# test if error log file is empty
if [ -s /tmp/errors.txt ]; then
.....
fi'