[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Probing for the existence of a device.
From: |
Andrey Borzenkov |
Subject: |
Re: Probing for the existence of a device. |
Date: |
Mon, 24 Jun 2013 06:18:20 +0400 |
В Sun, 23 Jun 2013 23:19:11 +0100
João Ricardo Sares Teles de Matos <address@hidden> пишет:
>
> However, it doesn't work as one would initially expect.
> This example illustrates the problem:
>
> for drive in (hd0) (hd1) (hd2); do
> menuentry "Echo the value of \$drive (it should be $drive)" {
> echo "The value of \$drive is $drive"
> sleep 5
> }
> done
>
> This creates three menu entries, with (hd0), (hd1) and (hd2) in the title.
> When choosing the menu, however, all three entries echo "The value of $drive
> is (hd2)".
>
> The expansion of $drive within the menuentry is deferred to the moment when
> the menu entry is activated, which causes all menu entries to expand to the
> last value assigned to the variable drive, (hd2).
>
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
signature.asc
Description: PGP signature