#!/bin/bash #WINDOWS_ENTRY=`grep "menuentry " /boot/grub/grub.cfg | grep --line-number Windows` #MENU_NUMBER=$(( `echo $WINDOWS_ENTRY | sed -e "s/:.*//"` - 1 )) #sudo grub-reboot $MENU_NUMBER #sudo reboot WINDOWS_TITLE=$(grep -i 'windows' /boot/grub/grub.cfg|grep "^[^#;]"|cut -d"'" -f2) sudo grub-reboot "$WINDOWS_TITLE" echo "Your computer will reboot on ${WINDOWS_TITLE} in 3 seconds, press Ctrl+C if you want to abord it" sleep 3 && sudo reboot