mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-04 12:43:05 +02:00
Address code review feedback: improve find commands
Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>
This commit is contained in:
parent
ef617c8810
commit
b42c90572b
@ -64,9 +64,7 @@ for track in "${!TRACKS[@]}"; do
|
||||
|
||||
# Show exercise count
|
||||
if [[ -d "$track/exercises/practice" ]]; then
|
||||
count=$(find "$track/exercises/practice" -maxdepth 1 -type d | wc -l)
|
||||
# Subtract 1 for the parent directory itself
|
||||
count=$((count - 1))
|
||||
count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d | wc -l)
|
||||
echo " → $count practice exercises available"
|
||||
fi
|
||||
echo ""
|
||||
@ -102,9 +100,7 @@ echo ""
|
||||
echo "Track summary:"
|
||||
for track in "${!TRACKS[@]}"; do
|
||||
if [[ -d "$track/exercises/practice" ]]; then
|
||||
count=$(find "$track/exercises/practice" -maxdepth 1 -type d 2> /dev/null | wc -l)
|
||||
# Subtract 1 for the parent directory itself
|
||||
count=$((count - 1))
|
||||
count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d 2> /dev/null | wc -l)
|
||||
printf " %-15s %3d exercises\n" "$track" "$count"
|
||||
fi
|
||||
done | sort
|
||||
|
||||
Loading…
Reference in New Issue
Block a user