是否可以根据 grub 菜单项中的某些条件返回上一级?

是否可以根据 grub 菜单项中的某些条件返回上一级?

看起来不可能中止菜单项内容,例如:

submenu test1 {
  menuentry test2 {
    echo "play1"
    cmd1 # even this failed, it still continue to next line
    echo "play2"
    return 1 # this also does not work
    exit # this works but it exit the entire grub
    echo "play3"
  }
}

我想要的类似于set -ebash,但只返回上一个菜单。我该如何实现?

相关内容