shell 登录 .bash_profile

shell登录两种方式

   交互式登录:

                  1,直接通过终端输入账号密码登录

                  2,使用 "su - UserName"   切换的用户

       执行顺序:/etc/profile  -->   /etc/profile.d/*.sh   -->   ~/.bash_profile  -->  ~/.bashrc -->   /etc/bashrc

  非交互式登录:

                  1 su   UserName

                  2 图形界面下打开的终端

                  3 执行脚本

                  4 任何其他的bash实例

        执行顺序:   ~/.bashrc  -->  /etc/bashrc  -->  /etc/profile.d/*.sh

  Profile 类

        按功能划分,两类

                   profile类和bashrc类

        profile类:为交互式登录的shell提供配置

                  全局:/etc/profile ,/etc/profile.d/*.sh

                  个人:~/.bash_profile

                  功能:

                           1 用于定义环境变量

                           2 运行命令或脚本

          分工 :.bash_profile 一般放环境变量和启动程序   。建议

                     .bashrc    一般放别名和函数

 

posted @ 2018-04-16 17:01  Meteor&Shower  阅读(350)  评论(0编辑  收藏  举报