From efc2bb00edede604b03cd94e04ba40bdc087015f Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 8 Dec 2016 13:27:42 +0100 Subject: If statements changed to shorthand syntax. --- Bash/iptables-whiteblacklisting.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Bash') diff --git a/Bash/iptables-whiteblacklisting.sh b/Bash/iptables-whiteblacklisting.sh index 36f3c49..749f00d 100755 --- a/Bash/iptables-whiteblacklisting.sh +++ b/Bash/iptables-whiteblacklisting.sh @@ -112,14 +112,14 @@ IPTABLES --delete-chain "${BLACKLIST_CHAIN}" &> /dev/null #=============================================================================== # Create new whitelisting-/blacklisting chain #=============================================================================== -if [ ${MODE} == 'WHITELISTING' ]; then IPTABLES --new-chain "${WHITELIST_CHAIN}"; fi -if [ ${MODE} == 'BLACKLISTING' ]; then IPTABLES --new-chain "${BLACKLIST_CHAIN}"; fi +[ ${MODE} == 'WHITELISTING' ] && IPTABLES --new-chain "${WHITELIST_CHAIN}" +[ ${MODE} == 'BLACKLISTING' ] && IPTABLES --new-chain "${BLACKLIST_CHAIN}" #=============================================================================== # Create reference to the whitelisting-/blacklisting chain #=============================================================================== -if [ ${MODE} == 'WHITELISTING' ]; then IPTABLES --table filter --append INPUT --jump "${WHITELIST_CHAIN}"; fi -if [ ${MODE} == 'BLACKLISTING' ]; then IPTABLES --table filter --append INPUT --jump "${BLACKLIST_CHAIN}"; fi +[ ${MODE} == 'WHITELISTING' ] && IPTABLES --table filter --append INPUT --jump "${WHITELIST_CHAIN}" +[ ${MODE} == 'BLACKLISTING' ] && IPTABLES --table filter --append INPUT --jump "${BLACKLIST_CHAIN}" #=============================================================================== # Create IPTables matching rules for whitelisting @@ -152,5 +152,5 @@ ${IPTABLES_V6} --append INPUT --source fe80::/64 --jump ACCEPT #=============================================================================== # Save IPTables configuration permanent #=============================================================================== -if [ ${IPTABLES_SAVE_V4} ]; then ${IPTABLES_SAVE_V4} > /etc/iptables/rules.v4; fi -if [ ${IPTABLES_SAVE_V6} ]; then ${IPTABLES_SAVE_V6} > /etc/iptables/rules.v6; fi \ No newline at end of file +[ ${IPTABLES_SAVE_V4} ] && ${IPTABLES_SAVE_V4} > /etc/iptables/rules.v4 +[ ${IPTABLES_SAVE_V6} ] && ${IPTABLES_SAVE_V6} > /etc/iptables/rules.v6 \ No newline at end of file -- cgit v1.2.3