userscripts/reboot-dmenu
2024-05-30 23:04:56 -07:00

9 lines
362 B
Bash
Executable file

#!/bin/sh
# cat /boot/grub/grub.cfg | sed -n "s/^menuentry [\"']\([^\"']*\)[\"'].*$/\1/gmp" | dmenu -i | tr -d '\n' | sudo xargs -t -r0 -n1 grub-reboot
# sudo /usr/bin/reboot
entry="$(sed -n "s/^menuentry [\"']\([^\"']*\)[\"'].*$/\1/gmp" /boot/grub/grub.cfg | dmenu -i | tr -d '\n')"
if [ -n "$entry" ]; then
sudo grub-reboot "$entry"
sudo /usr/bin/reboot
fi