Skip to content

Instantly share code, notes, and snippets.

@ladar
Created November 4, 2016 00:04
Show Gist options
  • Save ladar/f7880ab7c2597182d1bc217e511a5954 to your computer and use it in GitHub Desktop.
Save ladar/f7880ab7c2597182d1bc217e511a5954 to your computer and use it in GitHub Desktop.
#!/bin/bash
confirm_reboot() {
read -s -p "Should we reboot and see if the configuration changes worked? [y|N] " -n 1 ANSWER
if [[ $ANSWER =~ [YyNn]$ ]]; then echo $ANSWER;
else echo; fi
}
while true; do
confirm_reboot
if [[ $ANSWER =~ [Nn]$ ]]; then
echo "Okay, exiting for now..."
exit 1
elif [[ $ANSWER =~ [Yy]$ ]]; then
break
fi
done
echo "Rebooting..."
sleep 1
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment