Skip to content

Commit 941f788

Browse files
committed
Use find in posix compliant way
1 parent df5d605 commit 941f788

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.bashrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
THIS_FILE="${BASH_SOURCE[0]}"
22
THIS_DIR=`dirname "$THIS_FILE"`
33

4-
SCRIPTS=`find "$THIS_DIR" -name '*.bash' -type f -printf '%h\0%d\0%p\n' | sort -t '\0' -n | awk -F'\0' '{print $3}'`
4+
SCRIPTS=`find "$THIS_DIR" -name '*.bash' -type f | while read -r file; do
5+
dir=$(dirname "$file")
6+
depth=$(echo "$file" | tr -cd "/" | wc -c)
7+
printf "%s\x1F%d\x1F%s\n" "$dir" "$depth" "$file"
8+
done | sort -t $'\x1F' -k2n | cut -d $'\x1F' -f3`
59
for SCRIPT in $SCRIPTS; do
610
# shellcheck source=/dev/null
711
source "$SCRIPT"

0 commit comments

Comments
 (0)