Simplify for loop, handle .conf files with spaces in them (although why

would anyone do that?)
This commit is contained in:
Warren Togami 2010-01-24 20:20:58 +00:00
parent 0bff0b0c77
commit 5baef96e14

View File

@ -26,7 +26,8 @@ fi
CHANNELLIST=""
KEYLIST=""
# Process each channel defined in /etc/mail/spamassassin/channel.d/
for file in $(find -L /etc/mail/spamassassin/channel.d/ -mindepth 1 -maxdepth 1 -type f -name '*.conf'); do
for file in /etc/mail/spamassassin/channel.d/*.conf; do
[ ! -f "$file" ] && continue
# Validate config file
PREFIXES="CHANNELURL KEYID BEGIN"
for prefix in $PREFIXES; do
@ -35,12 +36,12 @@ for file in $(find -L /etc/mail/spamassassin/channel.d/ -mindepth 1 -maxdepth 1
exit 255
fi
done
. $file
#echo "CHANNELURL=$CHANNELURL"
#echo "KEYID=$KEYID"
. "$file"
echo "CHANNELURL=$CHANNELURL"
echo "KEYID=$KEYID"
CHANNELLIST="$CHANNELLIST $CHANNELURL"
KEYLIST="$KEYLIST $KEYID"
sa-update --import $file
sa-update --import "$file"
done
# Sleep random amount of time before proceeding to avoid overwhelming the servers