bash not reading files in /etc/profile.d

As I described, your problem may be related by whatever you’re trying to do.

I don’t think so. Like I said before, I’m no trying to do anything fancy; just trying to understand why gnome-terminal is not picking up the change I’ve made.

Let me exemplify better. /etc/profile has this code in it:

if test -d /etc/profile.d -a -z "$PROFILEREAD" ; then
    for s in /etc/profile.d/*.sh ; do
        test -r $s -a ! -k $s && . $s
    done
    unset s
fi

This if checks whether files in /etc/profile.d should be sourced or not.

Now, for testing purposes, adding an alias:

if test -d /etc/profile.d -a -z "$PROFILEREAD" ; then
        alias 'testalias'='echo hello'
    for s in /etc/profile.d/*.sh ; do
        test -r $s -a ! -k $s && . $s
    done
    unset s
fi

Again, on TTY, sudo -i and su - username all work fine.

The alias is never set on my system when using gnome-terminal. It seems that PROFILEREAD is always true, preventing the *if.

*What I want to understand is: why is PROFILEREAD true even after rebooting the system? Supposedly caching the files in profile.d in order to improve speed is a feature. At the same time, I believe that never refreshing the cache to be an anti-feature.