To distinguish the difference between the two, we must first make clear
no-login shellThe difference between.
When you enter the user name and password through the terminal, and then enter terminal, the shell environment you enter is called login shell, for example, through
sshRemote access to the host.
As the name implies, it is a shell environment that does not need to enter the user name and password. For example, if you have logged in to your desktop computer, you can find it in the application manager
termianlIcon, and then double-click to open the terminal, that is, through the
KDEThe terminal entered by this desktop environment is the so-called shell environment you enter
no-login shellEnvironmental Science. In short, it means that you want to pass
login shellRun the shell command into the
.bash_profileI want to pass
no-login shellRun the shell command into the
.bashrcIn the document.
There’s an exception to this
Mac OSIn the system, every time you run terminal, the system will run one for you by default
login shellEnvironment, so you see
~/There is only one in the directory
.bashrcDocuments, that’s why.
How to use two files at the same time?
So if I was
Mac OSThe system also wants to put some shell commands into the
.bashrcWhat about the file? Of course, it’s not recommended. It doesn’t make sense. Then you can create a
.bashrcDocuments. Then in
.bash_profileWrite the following code in the file:
if [ -f ~/.bashrc ]; then source ~/.bashrc fi
Read at terminal
.bash_profileIt will load after the file
.bashrcContents of the file.