summaryrefslogtreecommitdiffstats
path: root/Bash
diff options
context:
space:
mode:
authorThomas Lange <code@nerdmind.de>2016-12-08 13:27:42 +0100
committerThomas Lange <code@nerdmind.de>2016-12-08 13:27:42 +0100
commitefc2bb00edede604b03cd94e04ba40bdc087015f (patch)
tree5fc09e83dc58239ec887169debed39ea55c5d3ff /Bash
parent3ceecc93b82c1f95a77abd843096e0bcef2a8938 (diff)
downloadsnippets-efc2bb00edede604b03cd94e04ba40bdc087015f.tar.gz
snippets-efc2bb00edede604b03cd94e04ba40bdc087015f.tar.xz
snippets-efc2bb00edede604b03cd94e04ba40bdc087015f.zip
If statements changed to shorthand syntax.
Diffstat (limited to 'Bash')
-rwxr-xr-xBash/iptables-whiteblacklisting.sh12
1 files changed, 6 insertions, 6 deletions
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