Skip to content

Instantly share code, notes, and snippets.

@williamcanin
Last active August 29, 2015 14:27
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 williamcanin/61c2de439b18bfc9b175 to your computer and use it in GitHub Desktop.
Save williamcanin/61c2de439b18bfc9b175 to your computer and use it in GitHub Desktop.
Test If and Case using "Curl -L" through Gist
#!/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