This seems like a question that must have been asked a hundred times, but I can't seem to find the answer:
I'm installing miniconda on a remote machine with this script:
#!/bin/bash
set -xeu
mkdir -p miniconda3/
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -f
~/miniconda3/bin/conda init bash
echo 'export PATH="~/miniconda3/bin/:$PATH"' >> ~/.bash_profile
I then log out of the machine and back in and try running the following script:
#!/bin/bash
set -eux
# Test that conda is installed for interactive use
echo "conda --version" | bash -i
# Test the conda is installed for script use
conda --version
For the second call (script use) I get an error conda: command not found
.
I get the same behaviour when appending to ~/.bashrc
rather than ~/.bash_profile
in the last line of my install script or if I don't write to any of those.
According to the bash man page, I should be able to set the name of a config file in the BASH_ENV
environment variable, but how would I set that variable?
I seem to be missing something but I don't understand what.