I am having a little problem with my ubuntu16.04 terminal. I wanted to have access to a data-base through the use of the :

echo source /Infos/bd/config11 >> .bashrc

echo source /Infos/bd/config11 >> .bash_profile

However I unfortunately don't have acces to this data-base since it's not on my computer. Every time I open a terminal I see:

bash: /Infos/bd/config11: No such file or directory

What can I do to stop seeing this on my terminal?

Thank you.


To avoid seeing this, you should edit your startup scripts so they no longer attempt to source the missing file:

sed -i 'sXsource /Infos/bd/config11X#&X' ~/.bashrc ~/.bash_profile

This will comment out the line in both files.

  • Thank you very much. It solved my problem and I now have a normal terminal. – Elias Bendjaballah Mar 14 at 17:21

If your startup scripts are shared and you'd like the source command to execute if possible, then wrap it in a test:

[ -r /Infos/bd/config11 ] && source /Infos/bd/config11

On systems without that file (specifically, where your account is unable to read that path), the test will fail and you will not receive an error message; on systems with that file (where you can read that file), it will be sourced in.

You may not need to have the command in both files; see, for example What is the purpose of .bashrc and how does it work?, and/or your local bash man pages.

  • The test failed and I had no error message. However I managed to comment out the line which tried to access to that missing file and every thing is working correctly now. Thank you very much. – Elias Bendjaballah Mar 14 at 17:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.