Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

SOLVED how to source .bashrc automaticlly when user login

Joined
Jun 4, 2019
Messages
26
Thanks
1
#1
I searched for some time but got empty handed, this is not a big issue, I just want to be more "comfortable" :)

I created a user with bash shell, set the home directory on a pool and modified the .bashrc file in the user's home folder, login with ssh, run "source ~/.bashrc" and it works fine, but every time when I login I need to run "source .bashrc" manually. Is there a way to run ~/.bashrc automatically when user login?
 
Joined
Jun 4, 2019
Messages
26
Thanks
1
#3
Great! By creating a .bash_profile and put in these code it works fine:
Code:
if [ -r ~/.bashrc ]; then
   source ~/.bashrc
fi

It actually works the same way as mac...have done this on my mac just didn't recall it. Still new to linux/unix and learn everyday :)
 
Top