I am trying to set-up a system to boot at certain times to either DOS or
Linux I can set the default boot to Linux so when I ask the DOS to boot it
will boot to Linux, but how do I tell Linux to boot to dos from the Linux
command ?
I wrote the attached shell script for this. There's a not terribly-well-documented "--once" option to savedefault. Note that I've commented out the "exec reboot" in this version of the script, you don't want to know why :-)
#!/bin/bash if [ $(id -u) -ne 0 ]; then echo "${0##*/}: must be superuser" >&2 exit 1 fi IFS=" " set $(awk '$1 == "title" {sub(/^title[ ]*/, ""); print $0;}' /boot/grub/grub.conf) PS3="boot? " select boot do if [ -n "$boot" ] then number=$((REPLY-1)) echo "savedefault --default=$number --once" | grub --no-curses --device-map=/boot/grub/device.map >/dev/null # exec reboot fi break done