Skip to content

Commit fda3f61

Browse files
author
SMKRV
committed
refactor: Update process_domains function for better domain handling
1 parent 13ef871 commit fda3f61

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mikrotik-domain-filter-bash.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ process_domains() {
389389
log "Classifying domains from: $input"
390390

391391
# Create all required directories and files
392-
mkdir -p "${output_dir}"/{second,regional,other}
392+
mkdir -p "${output_dir}/{second,regional,other}"
393393

394394
local second_level="${output_dir}/second.txt"
395395
local regional="${output_dir}/regional.txt"
@@ -414,7 +414,8 @@ process_domains() {
414414

415415
# First pass - find all second-level and regional domains
416416
while IFS= read -r domain; do
417-
local parts; mapfile -t parts <<< "${domain//./ }"
417+
local parts
418+
IFS='.' read -ra parts <<< "$domain"
418419
local levels=${#parts[@]}
419420

420421
# Limit to 4th level
@@ -443,7 +444,8 @@ process_domains() {
443444

444445
# Second pass - filter subdomains
445446
while IFS= read -r domain; do
446-
local parts; mapfile -t parts <<< "${domain//./ }"
447+
local parts
448+
IFS='.' read -ra parts <<< "$domain"
447449
local skip=false
448450

449451
# Skip already processed domains

0 commit comments

Comments
 (0)