Skip to content

Instantly share code, notes, and snippets.

@masci
Created August 6, 2014 10:24
Show Gist options
  • Save masci/c4c3f47ba2cdbad79bb0 to your computer and use it in GitHub Desktop.
Save masci/c4c3f47ba2cdbad79bb0 to your computer and use it in GitHub Desktop.
runinenv.sh
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
if [ -f ${VENV}/bin/postactivate ]; then
. ${VENV}/bin/postactivate
fi
shift 1
#echo "Executing $@ in ${VENV}"
exec "$@"
deactivate
if [ -f ${VENV}/bin/postdeactivate ]; then
. ${VENV}/bin/postdeactivate
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment