Filename wildcard expansion in GRUB scripting
Asked Answered
E

1

6

Is it filename wildcard expansion possible in GRUB scripts?

Something like:

for i in directory/*; do echo $i; done

My intention is for GRUB to load different cfg files located in certain directories.

Exorcise answered 14/2, 2017 at 7:23 Comment(0)
F
4

Yes, this is possible if you have the regexp module, which seems to use the same syntax for filename expansion as bash. I discovered this accidentally and I still am not sure if there is any mention of this feature in the documentation. Example:

insmod regexp
for i in /opt/*; do echo $i; done

I entered this into GRUB 2.02 shell on my system and received this output:

/opt/sublime_text
/opt/google
Framboise answered 5/1, 2018 at 23:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.