Skip to content

Instantly share code, notes, and snippets.

@mattbell87
Last active February 23, 2016 23:56
Show Gist options
  • Save mattbell87/90a54e968ed39c9bdf6b to your computer and use it in GitHub Desktop.
Save mattbell87/90a54e968ed39c9bdf6b to your computer and use it in GitHub Desktop.
Automatically elevate to administrator for sudo on bash
#!/bin/bash
# Define the sudo override function
function sudo()
{
echo PASSWORDHERE | /usr/bin/sudo -kS \"$@\";
}
# Export for child scripts
export -f sudo
# Example
sudo ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment