Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- symlink these 3 files to a place that is in the path, like `$HOME/bin`:
- ```bash
- conda -> $HOME/miniconda3/bin/conda
- activate -> $HOME/miniconda3/bin/activate
- deactivate -> $HOME/miniconda3/bin/deactivate
- ```
- and edit conda/activate/deactivate to reflect these changes.
- The tricky is in the `funcstack[1]` that gets the function directory from the symlink.
- activate
- ```shell
- #!/bin/bash
- # Determine the directory containing this script
- if [[ -n $BASH_VERSION ]]; then
- _SCRIPT_LOCATION=${BASH_SOURCE[0]}
- _SHELL="bash"
- elif [[ -n $ZSH_VERSION ]]; then
- _SCRIPT_LOCATION=${funcstack[1]}
- _SHELL="zsh"
- else
- echo "Only bash and zsh are supported"
- return 1
- fi
- _CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")
- .
- .
- .
- ```
- deactivate
- ```shell
- #!/bin/bash
- # Determine the directory containing this script
- if [[ -n $BASH_VERSION ]]; then
- _SCRIPT_LOCATION=${BASH_SOURCE[0]}
- _SHELL="bash"
- elif [[ -n $ZSH_VERSION ]]; then
- _SCRIPT_LOCATION=${funcstack[1]}
- _SHELL="zsh"
- else
- echo "Only bash and zsh are supported"
- return 1
- fi
- _CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")
- .
- .
- .
- ```
- PS: I belive these made upstream!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement