4

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.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Manuel
  • 41
  • 3

1 Answers1

2

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
Norrius
  • 7,558
  • 5
  • 40
  • 49