read does not read last line without a newline
This commit is contained in:
@@ -17,7 +17,8 @@ ipset flush cloudron_blocklist
|
||||
user_firewall_json="/home/yellowtent/boxdata/firewall/blocklist.txt"
|
||||
|
||||
if [[ -f "${user_firewall_json}" ]]; then
|
||||
while read -r line; do
|
||||
# without the -n block, any last line without a new line won't be read it!
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
[[ -z "${line}" ]] && continue # ignore empty lines
|
||||
[[ "$line" =~ ^#.*$ ]] && continue # ignore lines starting with #
|
||||
ipset add cloudron_blocklist "${line}"
|
||||
|
||||
Reference in New Issue
Block a user