Create a grub-list.zsh command
For listing the available kernels on the current machine Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
8a73ed3a61
commit
e615a2d36b
|
@ -0,0 +1,7 @@
|
||||||
|
#compdef grub-list.zsh
|
||||||
|
|
||||||
|
function _grub-list.zsh() {
|
||||||
|
_arguments \
|
||||||
|
{-h,--help}'[print help text]' \
|
||||||
|
{-e,--entries-only}'[print entries without row numbers]'
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
cmd=$0
|
||||||
|
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
|
Loading…
Reference in New Issue