fix: refactor script discovery to use shell globbing for improved performance
This commit is contained in:
18
setup.sh
18
setup.sh
@@ -24,19 +24,13 @@ if [ -d "$DOTFILES_DIR/scripts" ]; then
|
||||
log_info "Running setup scripts..."
|
||||
|
||||
script_count=0
|
||||
|
||||
# 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"; then
|
||||
log_success "✓ $script_name completed"
|
||||
else
|
||||
log_error "✗ $script_name failed"
|
||||
exit 1
|
||||
# Find and log all numbered scripts using shell globbing
|
||||
for script in "$DOTFILES_DIR/scripts"/[0-9][0-9]-*; do
|
||||
if [ -f "$script" ]; then
|
||||
script_name=$(basename "$script")
|
||||
log_info "Found script: $script_name"
|
||||
fi
|
||||
((script_count++))
|
||||
done < <(find "$DOTFILES_DIR/scripts" -name '[0-9][0-9]-*.sh' -type f | sort)
|
||||
done
|
||||
|
||||
if [ $script_count -eq 0 ]; then
|
||||
log_warning "No numbered scripts found in scripts/ directory"
|
||||
|
||||
Reference in New Issue
Block a user