Last active
April 19, 2023 13:24
-
-
Save hansfn/c15e700eff2994c8f14b52492f210321 to your computer and use it in GitHub Desktop.
A simple (g)awk script that lists the grub menu from the command line. Typically used when you use grub-set-default or grub-reboot. Tested with Grub 2 on Ubuntu 22.04. Assumes grub.cfg is well formed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems my work was wasted. The following one-liner does the same job:
awk -F\' '$1=="menuentry " || $1=="submenu " {print i++ " : " $2}; /\tmenuentry / {print "\t" i-1">"j++ " : " $2};' /boot/grub/grub.cfg
PS! All of this is coming from https://askubuntu.com/q/599208/