From fa742bc29b84cccbdc25004f8b7870bb9e9738f4 Mon Sep 17 00:00:00 2001 From: Ryan Hamilton Date: Mon, 4 Aug 2025 22:42:00 -0500 Subject: [PATCH] fix: refactor script execution to use a robust while-read loop in setup.sh --- setup.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup.sh b/setup.sh index 36369db..6c573c1 100644 --- a/setup.sh +++ b/setup.sh @@ -25,9 +25,8 @@ if [ -d "$DOTFILES_DIR/scripts" ]; then script_count=0 - # Find all numbered scripts and run them in order (universal for loop) - scripts=$(find "$DOTFILES_DIR/scripts" -name '[0-9][0-9]-*.sh' -type f | sort) - for script in $scripts; do + # Find all numbered scripts and run them in order (robust while-read loop) + while IFS= read -r script; do script_name=$(basename "$script") log_info "Running $script_name..." if bash "$script" "$DOTFILES_DIR"; then @@ -37,7 +36,7 @@ if [ -d "$DOTFILES_DIR/scripts" ]; then exit 1 fi ((script_count++)) - done + done < <(find "$DOTFILES_DIR/scripts" -name '[0-9][0-9]-*.sh' -type f | sort) if [ $script_count -eq 0 ]; then log_warning "No numbered scripts found in scripts/ directory"