Skip to content

Instantly share code, notes, and snippets.

@mariorez
Created February 5, 2015 13:06
Show Gist options
  • Save mariorez/fb2f97e1f9f25dba9177 to your computer and use it in GitHub Desktop.
Save mariorez/fb2f97e1f9f25dba9177 to your computer and use it in GitHub Desktop.
# Execute command as user
function uexec {
if [ $# -eq 1 ]; then
eval "(su - '$1')"
fi
if [ $# -eq 2 ]; then
eval "(su - '$1' -c '${2}')"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment