Last active
August 29, 2015 14:27
-
-
Save williamcanin/61c2de439b18bfc9b175 to your computer and use it in GitHub Desktop.
Test If and Case using "Curl -L" through Gist
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 | |
# Test If and Case using "Curl -L" through Gist | |
# | |
# | |
if [[ "$(id -u)" != "0" ]]; then | |
echo "You are not root!" | |
echo "You have the root password? (y/n)" | |
read -p "Reply: " reply | |
case "$reply" in | |
y|Y) | |
echo "Ok, now enter the password:" | |
su - root | |
;; | |
n|N) | |
echo | |
echo "Tell the administrator to have the password. Thanks." | |
echo | |
;; | |
*) | |
echo | |
echo "Option invalid!" | |
echo | |
;; | |
esac | |
else | |
echo | |
echo "You are already as root, brother :)" | |
echo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment