diff --git a/mainline/alpine-perl/20-envsubst-on-templates.sh b/mainline/alpine-perl/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/mainline/alpine-perl/20-envsubst-on-templates.sh
+++ b/mainline/alpine-perl/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/mainline/alpine/20-envsubst-on-templates.sh b/mainline/alpine/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/mainline/alpine/20-envsubst-on-templates.sh
+++ b/mainline/alpine/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/mainline/buster-perl/20-envsubst-on-templates.sh b/mainline/buster-perl/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/mainline/buster-perl/20-envsubst-on-templates.sh
+++ b/mainline/buster-perl/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/mainline/buster/20-envsubst-on-templates.sh b/mainline/buster/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/mainline/buster/20-envsubst-on-templates.sh
+++ b/mainline/buster/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/stable/alpine-perl/20-envsubst-on-templates.sh b/stable/alpine-perl/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/stable/alpine-perl/20-envsubst-on-templates.sh
+++ b/stable/alpine-perl/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/stable/alpine/20-envsubst-on-templates.sh b/stable/alpine/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/stable/alpine/20-envsubst-on-templates.sh
+++ b/stable/alpine/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/stable/buster-perl/20-envsubst-on-templates.sh b/stable/buster-perl/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/stable/buster-perl/20-envsubst-on-templates.sh
+++ b/stable/buster-perl/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")
diff --git a/stable/buster/20-envsubst-on-templates.sh b/stable/buster/20-envsubst-on-templates.sh
index b2b6e123044347b835c01e64ae121073919f3259..4d202a6fc16311a1882babc885e5dd51b8c0cfd6 100755
--- a/stable/buster/20-envsubst-on-templates.sh
+++ b/stable/buster/20-envsubst-on-templates.sh
@@ -16,7 +16,7 @@ auto_envsubst() {
     echo "$ME: ERROR: $template_dir exists, but $output_dir is not writable, exiting" 1>&2
     return 0
   fi
-  for template in $(find "$template_dir" -follow -name "*$suffix"); do
+  find "$template_dir" -follow -type f -name "*$suffix" -print | while read -r template; do
     relative_path="${template#$template_dir/}"
     output_path="$output_dir/${relative_path%$suffix}"
     subdir=$(dirname "$relative_path")