diff --git a/src/grub2/grub/grub.cfg b/src/grub2/grub/grub.cfg index 2c74650..bc39ede 100644 --- a/src/grub2/grub/grub.cfg +++ b/src/grub2/grub/grub.cfg @@ -2534,12 +2534,13 @@ function hiperiso_boot { fi # Derive log_dir from ISO basename. GRUB script has no ${var##*/} - # bash pattern; replicate it with regexp: match ".*/" greedily then - # the final segment. If iso_path has no '/', hiso_base stays as the - # whole path (acceptable fallback). + # bash pattern; replicate it with regexp. Use --set N:VAR syntax + # (the same form the Ventoy modsrc uses elsewhere in this file) so + # the captured group is bound to a named variable in the same scope + # rather than to the positional $1 in the if-statement branch. set hiso_base="$iso_path" - if regexp '.*/([^/]+)' "$iso_path" ; then - set hiso_base="$1" + if regexp --set 1:hiso_tail '.*/([^/]+)$' "$iso_path" ; then + set hiso_base="$hiso_tail" fi set hiso_log_dir="/hiperiso/logs/${hiso_base}/"