I am running a software where I want to check if miniconda
is already installed. Therefore I've checked whether 'miniconda' or 'anaconda' strings in .bashrc
file using the grep
command. However, it also finds either of above strings which are commented out in the .bashrc
file, which I do not want to have. How do I fix this? Relevant part of my bashscript
looks as follows.
#Finding if miniconda or anaconda string is in bashrc
if grep -qF -e miniconda -e anaconda "$HOME"/.bashrc ;then
echo "miniconda is found in .bashrc"
I've tested this by adding following lines in the .bashrc
file.
#anaconda
#miniconda
Terminal Output
jen@scs400:/scratch$ source bash_script.sh
miniconda is found in .bashrc
Try this: