Last active
October 16, 2017 20:05
-
-
Save maxpatternman/60a48eb7e8620276de23ae05f5e3daab to your computer and use it in GitHub Desktop.
Changes Grub Timeout to 1 Second
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# One-Liner command with sudo | |
#sudo sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/g' /etc/default/grub && sudo update-grub | |
path_to_grub=/etc/default/grub | |
if test ! -w ${path_to_grub}; then | |
echo "no permission, run as root" | |
exit 1 | |
fi | |
if ! (grep '^GRUB_HIDDEN_TIMEOUT' ${path_to_grub} &> /dev/null); then | |
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/g' ${path_to_grub} \ | |
&& (update-grub || echo echo "Something went wrong with update-grub") \ | |
|| echo "Something went wrong with sed ${path_to_grub}" | |
else | |
echo "Does not make sense if GRUB_HIDDEN_TIMEOUT is set" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment