在ubuntu中.profile 和.bashrc的加载区别
程序员文章站
2022-05-19 22:51:53
...
总之,profile不只是bash,在启动加载
bashrc是bash在,起bash session加载
bashrc是bash在,起bash session加载
.bashrc is for Bash only, while .profile is used by other shells as well. Another important difference is that .profile is used at the time when you log in, be it on a terminal, or into your desktop. So settings in there will apply always when youa re logged in. Bashrc on the other hand is executed each time you open a Bash session, for example every time you open a terminal. Here's an example, I want to add ~/bin to my path, so that I can run programs in that directory without having to type the full apth to them. Since I want that to wosk all the time, even for desktop applications, I need to define that in the .profile file. (doing it in .-bashrc would work for terminal only) On the other hand I also want to get a fortune every time I open a terminal. So I need to add the comamnd into my .bashrc. (doing it in .profile wouldn't have any noticeable effect when using terminal emulators, since the file wold execute when I log into my desktop, not for each terminal I open).
推荐阅读
-
照片和图形在平面设计中的区别与应用
-
ubuntu系统中/etc/rc.local和/etc/init.d/rc.local的区别详解
-
jQuery中attr()和prop()在修改checked属性时的区别
-
照片VS图形:详解照片和图形在平面设计中的区别与应用
-
在WordPress中实现评论头像的自定义默认和延迟加载
-
在C++中,函数名前的const和函数名后的const的区别详解
-
在JavaScript中,defer和async的区别介绍
-
在jQuery ajax中按钮button和submit的区别分析
-
JSON在Javascript中的使用(eval和JSON.parse的区别)详细解析
-
照片和图形在平面设计中的区别与应用