Please read http://mywiki.wooledge.org/DotFiles#Remote_shell_logins (perhaps read http://mywiki.wooledge.org/DotFiles#Console_logins first). The key to understanding this is to know that there are three basic types of shell startup:
- Login shell - Interactive shell - Non-login Non-interactive shell (scripts and -c) Each of these startup modes source different files. You need to make sure you layout your initialization files with that in mind.