read does not read last line without a newline

This commit is contained in:
Girish Ramakrishnan
2020-09-14 13:52:10 -07:00
parent 20e206fa43
commit fb5bfaa2bd
2 changed files with 3 additions and 2 deletions

View File

@@ -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}"