Skip to content

Instantly share code, notes, and snippets.

@bichotll
Last active December 16, 2015 03:39
Show Gist options
  • Save bichotll/5371262 to your computer and use it in GitHub Desktop.
Save bichotll/5371262 to your computer and use it in GitHub Desktop.
Just a simple bash alert for sudo command. To do it permanent just copy it along your ".bash_profile" file of your home. Maybe it could save you from a "sudo rm / -R" because you forgot the "." before the slash...
#just a secure sudo
bic_sudo() {
echo -e "\e[0;31mAre you sure\e[00;m that you want to use sudo?";
echo -e "\e[0;34mMaybe you can do it in other way..."
echo -e -n '\e[00m'
read suresudo;
if [ $suresudo == "yes" ] || [ $suresudo == "y" ] ;
then
sudo $@;
else
echo -e "Remember:\e[0;32mEvery time you do a bash mistake god kills a kitten"
echo -e -n '\e[00m'
fi
}
alias sudo='bic_sudo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment