Skip to content

Commit 9fe87aa

Browse files
committed
Deletion of unneeded variable
1 parent 7697134 commit 9fe87aa

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

hosts2iptables

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33

44
################################# Default Values ###############################
5-
# This is me and always me :-)
6-
funilrys='funilrys'
7-
85
# This is the current version of this script.
96
versionNumber='1.0.0'
107
################################################################################
@@ -94,38 +91,38 @@ else
9491
then
9592
# This initiate the input file
9693
input="${1}"
97-
98-
94+
95+
9996
if [[ ${2} != '' ]]
10097
then
10198
# We check if there is a fixed output. If it's not we save the
10299
# output to ${PWD}iptables.rules
103100
outputFile="${2}"
104101
fi
105-
102+
106103
# We read our file to an array.
107104
readarray fileContent < ${input}
108-
105+
109106
# We reset the iptables.
110107
reset_iptables
111-
108+
112109
# We set the iptable base.
113110
set_iptables_base
114-
111+
115112
for i in ${!fileContent[*]}
116113
do
117114
# We go through the array and initate the domain we are going to add
118115
# to IPTABLES.
119116
readedLine="$(echo "${fileContent[${i}]}" |cut -d $'\n' -f1)"
120-
117+
121118
case "${readedLine}" in
122119
\#*|"\n"|"")
123120
# If it's a commented line, we continue to the next line.
124121
continue
125122
;;
126123
*)
127124
domain="$(echo ${readedLine##* })"
128-
125+
129126
case "${domain}" in
130127
localhost|localhost.localdomain|local|broadcasthost|0.0.0.0)
131128
# If the domain is into that list we also continue
@@ -135,11 +132,11 @@ else
135132
esac
136133
;;
137134
esac
138-
135+
139136
# We set out rule
140137
${iptables} -A OUTPUT -d "${domain}" -j DROP > /dev/null 2>&1
141138
done
142-
139+
143140
# We save the rules into the fixed or desired output.
144141
${iptables_save} > ${outputFile}
145142
else

0 commit comments

Comments
 (0)