36e6838dd3
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
19 lines
523 B
Bash
Executable File
19 lines
523 B
Bash
Executable File
#!/bin/zsh
|
|
|
|
zparseopts e=entries -entries-only=entries h=help -help=help
|
|
|
|
if [ ! -z "$help" ]; then
|
|
echo "Usage: $0 [-h|--help] [-e|--entries-only]"
|
|
echo "List the available GRUB menu options."
|
|
echo " -e, --entries-only print menu entries without row numbers"
|
|
echo " -h, --help print this message and exit"
|
|
exit 0
|
|
fi
|
|
|
|
menuentries=$(sudo awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg)
|
|
if [ -z "$entries" ]; then
|
|
echo $menuentries | awk '{print " ", NR-1, " ", $0}'
|
|
else
|
|
echo $menuentries
|
|
fi
|