From 5baef96e147093898e67294f77c3150bfbfea0d0 Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Sun, 24 Jan 2010 20:20:58 +0000 Subject: [PATCH] Simplify for loop, handle .conf files with spaces in them (although why would anyone do that?) --- sa-update.cronscript | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sa-update.cronscript b/sa-update.cronscript index 187b9a0..e327259 100644 --- a/sa-update.cronscript +++ b/sa-update.cronscript @@ -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