Skip to content

Instantly share code, notes, and snippets.

@mentix02
Last active October 19, 2019 00:00
Show Gist options
  • Save mentix02/18c3633f2982b4fdbe63801f360ecd98 to your computer and use it in GitHub Desktop.
Save mentix02/18c3633f2982b4fdbe63801f360ecd98 to your computer and use it in GitHub Desktop.
This is probably the most complex command I've ever crafted to find the virtual enviornments directory in the user's home directory and activate if an enviornment with the same name as the current directory is found (or fail if not found).
source `find /home/$USER -maxdepth 2 -type d -name '.*' 2>/dev/null | grep virtualenv | head -1`/${PWD##*/}/bin/activate
source `find /Users/$USER -maxdepth 2 -type d -name '.*' 2>/dev/null | grep virtualenv | head -1`/${PWD##*/}/bin/activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment