Skip to content

Instantly share code, notes, and snippets.

@pirhoo
Created October 9, 2013 14:14
Show Gist options
  • Save pirhoo/6901994 to your computer and use it in GitHub Desktop.
Save pirhoo/6901994 to your computer and use it in GitHub Desktop.
Relative path for relocatable Virtualenv
#!/bin/sh
#...
VIRTUAL_ENV=`readlink -f ${BASH_SOURCE[0]:-$0}`;
# dirname gives us the containing dir (env/bin) path
VIRTUAL_ENV=`dirname "${VIRTUAL_ENV}"`;
# we do it once again to get the upper dir
VIRTUAL_ENV=`dirname "${VIRTUAL_ENV}"`;
export VIRTUAL_ENV;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment