1
0

fix indexing issue

This commit is contained in:
dtb 2024-03-20 19:15:32 -06:00
parent a95fab945f
commit 1b1936c7c7

View File

@ -24,18 +24,18 @@ for f in "$@"; do
|| usage || usage
unzip -d "$d"/x "$f" unzip -d "$d"/x "$f"
rm "$d"/x/*.xml rm -f "$d"/x/*.xml
for g in "$d"/x/*; do for g in "$d"/x/*; do
# if there aren't enough leading zeroes # if there aren't enough leading zeroes
if ! printf '%s' "$i" \ if ! printf '%s' "$i" \
| wc -c \ | wc -c \
| xargs test "$il" =; then | xargs test "$il" =; then
for g in "$d"/* for h in "$d"/*
do test "$g" = "$d"/x \ do test "$h" = "$d"/x \
|| printf '%s\n' "$g" \ || printf '%s\n' "$h" \
| sed 's|[^/]*$|0&|' \ | sed 's|[^/]*$|0&|' \
| xargs mv "$g" | xargs mv "$h"
done done
# update index digit length # update index digit length
il="$(printf '1 + %s\n' "$il" | bc)" il="$(printf '1 + %s\n' "$il" | bc)"