- local conf
- for conf in "$tool"/etc/nsd3/zone.d/*.conf
- do conf=${conf#"$tool"/etc/nsd3/zone.d/}
- local domain=${conf%.conf}
- if test -e "$tool"/etc/nsd3/zone.d/"$domain".zone.m4
+ for zone in $(find "$tool"/etc/nsd3/zone.d \
+ -mindepth 1 -maxdepth 1 -type f \
+ -false ${@:+$(printf -- '-or -name %s.conf\n' "$@")} \
+ -printf '%f\n')
+ do zone=${zone%.conf}
+ if test -e "$tool"/etc/nsd3/zone.d/"$zone".zone.m4