Skip to content

Instantly share code, notes, and snippets.

@maxpatternman
Last active October 16, 2017 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpatternman/60a48eb7e8620276de23ae05f5e3daab to your computer and use it in GitHub Desktop.
Save maxpatternman/60a48eb7e8620276de23ae05f5e3daab to your computer and use it in GitHub Desktop.
Changes Grub Timeout to 1 Second
#!/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