Last active
March 27, 2019 10:08
-
-
Save mattparkins/3b96e5478eaa69d4e547585c5f43d7be to your computer and use it in GitHub Desktop.
Are we already su? If not then ask for it
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
# Are we already su? If not then ask for it | |
if [[ "$EUID" != 0 ]]; then | |
sudo -k # make sure to ask for password on next sudo | |
if ! sudo true; then | |
echo "Password fail, aborting" | |
exit 1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment