GRUB2 allows essentially arbitrary numbers of positional arguments, so
ensure that they can be evaluated within scripts. GRUB2 also appears
to support arbitrary numbers of leading 0's in positional parameters
(i.e., $01 should evalute the same as $1), but this doesn't seem like
a particularly important case to support.
Tested:
Modified test-grub2-pos-param to cover higher-numbered positional
arguments.
Signed-off-by: Alan Dunn <amdunn@google.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
WORD [^{}|&$;<> \t\n'"#]+
DELIM [ \t]+
BLANK ["]{2}|[']{2}
-VARNAME ([[:alpha:]][_[:alnum:]]*|[0-9]|[\?@\*#])
+NUMBER 0|[1-9][0-9]*
+VARNAME ([[:alpha:]][_[:alnum:]]*|{NUMBER}|[\?@\*#])
%%
#if 0 /* PARSER_EMBEDDED_CONFIG */
function set_params_var {
- params="$1 $2"
+ params="$1 $2 $10"
}
menuentry 'Linux' {
- set_params_var abc 123
+ set_params_var abc 123 3 4 5 6 7 8 9 bingo
linux test_kernel $params
}
/* The linux command, $params is expected to have been set when
* set_params was called in menuentry.
*/
- check_args(opt, "abc 123");
+ check_args(opt, "abc 123 bingo");
}