简体   繁体   中英

In Linux, when does the “bash” command source a ~/.bash_profile or ~/.profile file?

I am currently using ssh to access a linux computer. I use the command:

ssh -t user@hostaddress 'cd ~/Desktop && bash'

When I get there, I see that neither ~/.bash_profile nor ~/.profile are sourced. What are the rules surrounding when these are sourced in? The reason I call bash is because I am able to get terminal colors when I do bash (blue folders, etc) that I otherwise cannot get just by using ssh user@hostaddress .

You're not running bash as a login shell -- using bash -l should source .bash_profile . Otherwise you can use .bashrc .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM