I'd like to come up with a way to always source the user's profile and bash configuration files upon a interactive login or non-interactive login despite what file structure they may have. It would also be nice for it not to matter which flavor of Linux is installed on the machine.
For example, not everyone has a ~/.bashrc or ~/.bash_profile file, but if they do they should be sourced.
My initial thought would be something like this (this is being run programmatically after a ssh):
[ -r /etc/profile ] && . /etc/profile;[ -r ~/.bash_profile ] && . ~/.bash_profile;[ -r ~/.profile ] && . ~/.profile;[ -r ~/.bashrc ] && . ~/.bashrc; OTHER COMMANDS...
However, this isn't quite working as I planned. The functions from the .bashrc file do not seem to be loaded in.
I appreciate any help! Thanks.
Edit: Adding full SSH command
ssh -p 22 dev@123 '[ -r /etc/profile ] && source /etc/profile;[ -r ~/.bash_profile ] && source ~/.bash_profile;[ -r ~/.profile ] && source ~/.profile;[ -r ~/.bashrc ] && source ~/.bashrc;cd ~/apps/my-project/;npm install;bower install;grunt production;~/start-apps.sh;' In my case, the command 'grunt' isn't being found because it's initiated in the .bashrc file.