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)
shopt -u nullglob
# Run each discovered script
for script in "${scripts[@]}"; do
script_name=$(basename "$script") script_name=$(basename "$script")
log_info "Running $script_name..." log_info "Running $script_name..."
if bash "$script" "$DOTFILES_DIR"; then # Source the script to run in the current shell and receive $DOTFILES_DIR as $1
if source "$script" "$DOTFILES_DIR"; then
log_success "$script_name completed" log_success "$script_name completed"
else else
log_error "$script_name failed" log_error "$script_name failed"
exit 1 exit 1
fi fi
((script_count++)) ((script_count++))
fi
done done
if [ $script_count -eq 0 ]; then if [ $script_count -eq 0 ]; then