name : fix_numbering fix counter.

This commit is contained in:
Dmitry Voronin 2023-12-10 07:26:04 +03:00
parent 2bc5285df9
commit 2ece1cfb59

View file

@ -487,13 +487,16 @@ function name_fix_numbering() {
# All files by default. # All files by default.
if [[ "${targets[*]}" = "" ]]; then if [[ "${targets[*]}" = "" ]]; then
targets=(*) targets=($(ls))
total=${#targets[@]} total=${#targets[@]}
fi fi
# Count leading zeroes. # Count leading zeroes.
local highest=0 local highest=0
for target in "${targets[@]}"; do for target in "${targets[@]}"; do
# Check that starts with a digit.
[[ "${target}" =~ ^[0-9] ]] || continue
local digits=($(_parse_ints "${target}")) local digits=($(_parse_ints "${target}"))
local digit="${digits[0]}" local digit="${digits[0]}"
digit=$((10#${digit})) digit=$((10#${digit}))