title: Python - Activate conda env through shell script
body: <p>I am hoping to run a simple shell script to ease the management around some conda environments.  Activating conda environments via <code>conda activate</code> in a <code>linux</code> os works fine in the shell but is problematic within a shell script.  Could someone point me into the right direction as to why this is happening?</p>
  <p>Example to repeat the issue:</p>
  <pre><code># default conda env
  $ conda info | egrep &quot;conda version|active environment&quot;
       active environment : base
            conda version : 4.6.9
  
  # activate new env to prove that it works
  $ conda activate scratch
  $ conda info | egrep &quot;conda version|active environment&quot;
       active environment : scratch
            conda version : 4.6.9
  
  # revert back to my original conda env
  $ conda activate base 
  
  $ cat shell_script.sh
  #!/bin/bash
  conda activate scratch
  
  # run shell script - this will produce an error even though it succeeded above
  $ ./shell_script.sh
  
  CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
  To initialize your shell, run
  
      $ conda init &lt;SHELL_NAME&gt;
  
  Currently supported shells are:
    - bash
    - fish
    - tcsh
    - xonsh
    - zsh
    - powershell
  
  See 'conda init --help' for more information and options.
  
  IMPORTANT: You may need to close and restart your shell after running 'conda init'.
  </code></pre>