Some bugs I found on scripting.
1. token parser
echo aa"bb"
aabb
(correct)
echo aa"bb"cc
aabb
(cc is lost)
echo aa$prefix
aa (hd0,1)/boot/grub
(should be one token)
echo $prefix/grub.cfg
(hd0,1)/boot/grub /grub.cfg
(should be one token)
The problem here is that when a variable is mixed with text, the token breaks.
I think this is also the reason why set doesn't work with variable.
set AA=1
set BB=$AA
will expand to
set AA=1
set BB= 1
Thereforce the value of BB is empty instead of 1.
2. function
There are a lot of problem with function.
I put this in grub.cfg:
function aa {
set AA=gfxterm
insmod $AA
}
And grub goes into an infinite loop:
syntax error
Incorrect command
syntax error
Incorrect command
...
But if I rewrite the function as
function aa {
set AA=gfxterm
insmod ${AA}
}
It display the menu properly.
Howerver, when I go to the grub console, and enter aa, it says:
error: unknown command `aa'
and lsmod shows no gfxterm module.
If I use aa before the first menuentry, the menu is not even displayed !
I put anothe function in grub.cfg:
function bb {
ls (hd0,1)/
}
enter console mode, enter bb:
error: unknown command `ls'
After this, ls command will fail.
Howerver, if I use ls before bb, it says:
error: unknow device
Later use of the ls command works.
Note: ls is not bundled in core.img.
Another function:
function cc {
set AA=1
echo ${AA}
}
This is similar to the bb example. If I use echo before cc, it says:
1
error: unknown command `cc'
If I use cc directly, it says:
error: unknow command `echo'
And later use of echo will fail.
--
Bean <[EMAIL PROTECTED]>
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel