Linux - GeneralThis forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi Guys, here is an interesting situation that I would like to see if anyone has an idea on.
For many years I have had two choices in my grub list:
1. Linux
2. Other OS of choice
Sometimes if I want to reboot into the other OS, I simply do a 'reboot' in a console. What I would like to do is to find a way to reboot and have choice 2 in my grub menu chosen automatically for this _one time only_.
For instance, if I wanted to reboot to the other OS, and knowing this OS is choice 2 in the grub menu I could issue a command such as:
reboot-grub-item 2
The reason I would like to do this is so that I don't have to sit at the PC waiting for Linux to shut down, restart to grub, and make the choice. I can just issue the command and go off and make myself a milo. Anyone have any ideas here?
I actually did make a script to do the job for me at /usr/local/bin/windows. In case anyone wants to use it:
Code:
#!/bin/bash
if [ "$1" != "-p" ]; then
echo -e "Do you wish to boot to windows? Use -p, ie: windows -p\n"
exit
fi
echo "savedefault --default=3 --once" | grub --batch
reboot
Of course replace the -default=3 with the correct choice in your own grub menu. The numbering starts at 0. So in my case 3, is 4th in the list.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.