Created
November 4, 2016 00:04
-
-
Save ladar/f7880ab7c2597182d1bc217e511a5954 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/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