I have 3 config files: .bashrc sources .bashrc_common, and .profile sources .bashrc. Unfortunately, upon login to Gnome I get an error message saying that in .bashrc command foo was not found. But if foo is defined in a file sourced by .bashrc, why would it not be found?

# .profile

if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
# .bashrc_common

function foo {
    echo "foo $1"

# .bashrc

source $HOME/.bashrc_common
foo "hello"

Note that foo is available just fine everywhere in my terminal bash shells, it's just the Ubuntu login that is throwing the error.

2 Answers 2


The file I was sourcing from .bashrc had an explicit guard that prevented it from running when invoked non-interactively. The moral of the story is -- if you encounter issues with config files launched by Gnome, double-check that they don't have any explicit "only run in interactive shells" checks.


I think your GNOME is running a login shell instead of an interactive non-login shell reason why your bashrc is not sourced.

Just append to the end of bash_login the following :

source ~/.bashrc

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.