mirror of
https://github.com/kuhyx/scripts.git
synced 2026-07-04 14:23:08 +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
|
# Show exercise count
|
||||||
if [[ -d "$track/exercises/practice" ]]; then
|
if [[ -d "$track/exercises/practice" ]]; then
|
||||||
count=$(find "$track/exercises/practice" -maxdepth 1 -type d | wc -l)
|
count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d | wc -l)
|
||||||
# Subtract 1 for the parent directory itself
|
|
||||||
count=$((count - 1))
|
|
||||||
echo " → $count practice exercises available"
|
echo " → $count practice exercises available"
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
@ -102,9 +100,7 @@ echo ""
|
|||||||
echo "Track summary:"
|
echo "Track summary:"
|
||||||
for track in "${!TRACKS[@]}"; do
|
for track in "${!TRACKS[@]}"; do
|
||||||
if [[ -d "$track/exercises/practice" ]]; then
|
if [[ -d "$track/exercises/practice" ]]; then
|
||||||
count=$(find "$track/exercises/practice" -maxdepth 1 -type d 2> /dev/null | wc -l)
|
count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d 2> /dev/null | wc -l)
|
||||||
# Subtract 1 for the parent directory itself
|
|
||||||
count=$((count - 1))
|
|
||||||
printf " %-15s %3d exercises\n" "$track" "$count"
|
printf " %-15s %3d exercises\n" "$track" "$count"
|
||||||
fi
|
fi
|
||||||
done | sort
|
done | sort
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user