stevejenkins/postwhite

Better bash scripting

iredmail opened this issue · 1 comments

Your script has code like this:

aol=yes
google=yes
...

if [ "$aol" == "yes" ]; then
    host=aol.com
    $(query_host "$host");
fi

if [ "$google" == "yes" ]; then
    host=google.com
    $(query_host "$host");
fi

Maybe it's better to code this way:

hosts="aol.com google.com ..."

for h in ${hosts}; do
    $(query_host ${h})
done

It's shorter, cleaner.

With abc=yes, you don't know what the real domain name is, is it 'abc.com', or 'abc.net'? why not specify it explicitly?

Thanks for the suggestion, @iredmail.

Version 1.30 of Postwhite includes a modified version of this "shorter, cleaner" suggestion.

Rather than lumping all the hostnames of the trusted mailers into a single hosts option, I kept the same five categories as before, so it's slightly easier to find and manage the hosts you want to whitelist.

Here's the commit: aaea020

Thank you again. Your recommendation significantly shortened the script. Please feel free to make additional suggestions!