fix periodic snapshot upgrade env merge

This commit is contained in:
2026-06-29 16:59:00 +08:00
parent 4ca08a12a4
commit 8d15188ea8
2 changed files with 49 additions and 30 deletions

View File

@@ -416,10 +416,11 @@ max_existing_run_index() {
local run_name
local numeric_part
shopt -s nullglob
for run_dir in "$RUNS_ROOT"/run_[0-9][0-9][0-9][0-9]; do
for run_dir in "$RUNS_ROOT"/run_*; do
[[ -d "$run_dir" ]] || continue
run_name="$(basename "$run_dir")"
numeric_part="${run_name#run_}"
[[ "$numeric_part" =~ ^[0-9]+$ ]] || continue
if (( 10#$numeric_part > max_index )); then
max_index=$((10#$numeric_part))
fi