From 607543767bdc81e42318ef9700b2fe53e441badf Mon Sep 17 00:00:00 2001 From: zegonix Date: Thu, 28 May 2026 16:32:41 +0200 Subject: [PATCH] (bash) handling arrays of paths --- bash-test.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bash-test.sh b/bash-test.sh index a4c051a..0c196a8 100755 --- a/bash-test.sh +++ b/bash-test.sh @@ -1,11 +1,9 @@ #!/usr/bin/env bash -array=("test0" "test1" "test2") -suffix="henlo" +IFS=$'\n' +array=($(find . -mindepth 1 -maxdepth 1 -type d)) +unset IFS -echo "${array[@]}" -echo "" - -array=("${array[@]/%/${suffix}}") - -echo "${array[@]}" +for item in "${array[@]}"; do + echo "[ ${item} ]" +done