1
0

fix: streamline script execution by removing unnecessary array handling

This commit is contained in:
2025-08-04 23:12:10 -05:00
parent 2069e46f96
commit 27b29989e3

View File

@@ -24,22 +24,20 @@ if [ -d "$DOTFILES_DIR/scripts" ]; then
log_info "Running setup scripts..." log_info "Running setup scripts..."
script_count=0 script_count=0
# Collect numbered scripts into an array # Find and run all numbered scripts using shell globbing
# Enable nullglob to ensure no-match yields empty array for script in "$DOTFILES_DIR/scripts"/[0-9][0-9]-*.sh; do
shopt -s nullglob if [ -f "$script" ]; then
scripts=("$DOTFILES_DIR/scripts"/[0-9][0-9]-*.sh) script_name=$(basename "$script")
shopt -u nullglob log_info "Running $script_name..."
# Run each discovered script # Source the script to run in the current shell and receive $DOTFILES_DIR as $1
for script in "${scripts[@]}"; do if source "$script" "$DOTFILES_DIR"; then
script_name=$(basename "$script") log_success "$script_name completed"
log_info "Running $script_name..." else
if bash "$script" "$DOTFILES_DIR"; then log_error "$script_name failed"
log_success "$script_name completed" exit 1
else fi
log_error "$script_name failed" ((script_count++))
exit 1
fi fi
((script_count++))
done done
if [ $script_count -eq 0 ]; then if [ $script_count -eq 0 ]; then