Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. symlink these 3 files to a place that is in the path, like `$HOME/bin`:
  2.  
  3. ```bash
  4. conda -> $HOME/miniconda3/bin/conda
  5. activate -> $HOME/miniconda3/bin/activate
  6. deactivate -> $HOME/miniconda3/bin/deactivate
  7. ```
  8.  
  9. and edit conda/activate/deactivate to reflect these changes.
  10. The tricky is in the `funcstack[1]` that gets the function directory from the symlink.
  11.  
  12.  
  13. activate
  14. ```shell
  15. #!/bin/bash
  16.  
  17. # Determine the directory containing this script
  18. if [[ -n $BASH_VERSION ]]; then
  19. _SCRIPT_LOCATION=${BASH_SOURCE[0]}
  20. _SHELL="bash"
  21. elif [[ -n $ZSH_VERSION ]]; then
  22. _SCRIPT_LOCATION=${funcstack[1]}
  23. _SHELL="zsh"
  24. else
  25. echo "Only bash and zsh are supported"
  26. return 1
  27. fi
  28. _CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")
  29. .
  30. .
  31. .
  32. ```
  33.  
  34. deactivate
  35. ```shell
  36. #!/bin/bash
  37.  
  38. # Determine the directory containing this script
  39. if [[ -n $BASH_VERSION ]]; then
  40. _SCRIPT_LOCATION=${BASH_SOURCE[0]}
  41. _SHELL="bash"
  42. elif [[ -n $ZSH_VERSION ]]; then
  43. _SCRIPT_LOCATION=${funcstack[1]}
  44. _SHELL="zsh"
  45. else
  46. echo "Only bash and zsh are supported"
  47. return 1
  48. fi
  49. _CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")
  50. .
  51. .
  52. .
  53. ```
  54.  
  55. PS: I belive these made upstream!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement