Recently, I reinstalled ubuntu 16.04LTS on my desktop as a Linux server.
After a new user created, ssh into the server each time, but .bashrc (dot bashrc) not loaded after new user created? Please try to modify the profile as bellow.
After a new user created, ssh into the server each time, but .bashrc (dot bashrc) not loaded after new user created? Please try to modify the profile as bellow.
Append some commands into ~/.profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOT_BASHRC=~/.bashrc | |
# -n True if the length of string is non-zero. | |
# -r True if file exists and is readable. | |
if [ -n "$BASH" ] && [ -r "$DOT_BASHRC" ]; then | |
echo "load $DOT_BASHRC by ~/.profile" | |
source "$DOT_BASHRC" | |
fi |
result of test-cases.sh example
~$ source .profile
load /home/ben/.bashrc by ~/.profile
.bashrc has been executed once
load /home/ben/.bashrc by ~/.profile
.bashrc has been executed once