On 06/24/2013 03:18 AM, Andrey Borzenkov wrote:
> Pass value of $drive as parameter into menuentry. grub implicitly adds
> "setparams arg1 arg2 ..." for every non-option argument as the very
> first menuentry body statement.
>
> for drive in (hd0) (hd1) (hd2); do
> menuentry "Echo the value of \$drive (it should be $drive)" $drive {
> echo "The value of \$drive is $2"
> sleep 5
> }
> done
>
That enabled me to do what I wanted. Thank you!
I didn't know menuentry accepted parameters; that's an elegant and lightweight
solution to the problem.
I'll leave my final configuration here for people doing web searches on the
subject:
submenu "Chainload other devices." {
insmod regexp
for drive in *; do
menuentry "Chainload device: $drive" "$drive" {
set root="$2"
chainloader +1
boot
}
done
}
Thank you, again, to everyone who replied.
--
João Ricardo Sares Teles de Matos
[email protected]
Administração de Sistemas da Rede das Novas Licenciaturas
Instituto Superior Técnico
web: https://www.rnl.ist.utl.pt
email: [email protected]
telefone: +351 218 41 77 71
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
