Created
January 23, 2014 11:03
-
-
Save mitio/8576788 to your computer and use it in GitHub Desktop.
Some tools do not load a user's environment ($HOME, $PATH, etc.) when they run commands as that user. Sometimes, though, we need that environment. This script attempts to load it properly, before executing the command passed to it as arguments.
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/sh | |
RUNNING_AS=`whoami` | |
export HOME=`getent passwd $RUNNING_AS | cut -d: -f6` | |
source ~/.bashrc | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment