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="" CHANNELLIST=""
KEYLIST="" KEYLIST=""
# Process each channel defined in /etc/mail/spamassassin/channel.d/ # 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 # Validate config file
PREFIXES="CHANNELURL KEYID BEGIN" PREFIXES="CHANNELURL KEYID BEGIN"
for prefix in $PREFIXES; do 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 exit 255
fi fi
done done
. $file . "$file"
#echo "CHANNELURL=$CHANNELURL" echo "CHANNELURL=$CHANNELURL"
#echo "KEYID=$KEYID" echo "KEYID=$KEYID"
CHANNELLIST="$CHANNELLIST $CHANNELURL" CHANNELLIST="$CHANNELLIST $CHANNELURL"
KEYLIST="$KEYLIST $KEYID" KEYLIST="$KEYLIST $KEYID"
sa-update --import $file sa-update --import "$file"
done done
# Sleep random amount of time before proceeding to avoid overwhelming the servers # Sleep random amount of time before proceeding to avoid overwhelming the servers