Tai*_*iga 6 grub arch-linux shell-script
我想编写一个 shell 脚本来启动到 Windows,而无需等待正常的 grub 超时。
该命令不得更改 grub-timeout 的默认值,因为我仍然想在下次启动时选择 Linux 或 Windows。
就像是:
#!/bin/bash
sudo grub-reboot 2
# set timeout 0 temporarily
sudo reboot
Run Code Online (Sandbox Code Playgroud)
对于任何未来的读者,解决方案如下:
\n#!/bin/bash\nsudo efibootmgr -n [x]\nsudo reboot\nRun Code Online (Sandbox Code Playgroud)\n其中 [x] 是 Windows 启动管理器的索引(通常为 0),您可以通过运行找到它
\nefibootmgr -d -d\nRun Code Online (Sandbox Code Playgroud)\n不幸的是,设置下次启动似乎需要 sudo,因此即使您在 .zshenv 或 .bash_profile 中设置了别名或函数,您仍然需要输入密码。
\n感谢@MarcusM\xc3\xbcller 为我指明了正确的方向。
\n