Reputation: 22286
Anaconda Installing in silent mode says
The installer will not prompt you for anything, including setup of your shell to activate conda. To add this activation in your current shell session:
eval "$(command conda 'shell.bash' 'hook' 2> /dev/null)"
What does this line actually do and what files (eg. update bashrc or bash_profile, etc) are affected?
After having done this, what will happen when I open a bash shell or start a new login?
If there is a detailed documentation, please suggest.
Upvotes: 1
Views: 1465
Reputation: 76950
TLDR; Conda shell activation is the process of defining some shell functions that facilitate activating and deactivating Conda environments, as well as some optional features such as updating PS1 to show the active environment.
In Conda v4.4, there was a major overhaul with how Conda manages environment isolation. Part of this was to manage activation of environments with a shell function conda()
that takes arguments like activate
or install
, rather than having an activate
script which users previously had to source activate
.
The particular command in OP generates the bash code to define the conda()
function, some auxiliary functions it needs, and environment variables, then evaluates this code in your current shell. The reason why this isn't a fixed script is that what Conda does here is generated on the fly using the conda
entry point (i.e., Python code), and takes into account the configuration settings found in ~/.condarc
.
You can completely inspect this code without evaluating it by just running
conda shell.bash hook
which will output the code as a string. The common elements everyone will see are the conda()
function and its auxiliaries (e.g., starting with __conda_
). Other aspects are configuration-dependent. For instance, if auto_activate_base
is true (the default), then a conda activate base
will be emitted at the end.
Upvotes: 2