(bash) dirname/basename with variable expansion

This commit is contained in:
scbj
2026-06-01 09:30:21 +02:00
parent 607543767b
commit 4cf6c18b81
+3 -6
View File
@@ -1,9 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
IFS=$'\n' path="$(realpath "${BASH_SOURCE}")"
array=($(find . -mindepth 1 -maxdepth 1 -type d))
unset IFS
for item in "${array[@]}"; do echo "path: ${path%/*}"
echo "[ ${item} ]" echo "file: ${path##*/}"
done