变量配置文件

按照生效范围划分,存在两类:

 全局配置:

  /etc/profile
  /etc/profile.d/*.sh
  /etc/bashrc

 个人配置

  ~/.bash_profile
  ~/.bashrc

按照shell登陆,存在两类:

 交互式登陆:

  (1) 直接通过终端输入账号密码登录
  (2) su - UserName” 切换的用户
  执行顺序:/etc/profile-->/etc/profile.d/*.sh -->~/.bash_profile -->/.bashrc -->/etc/bashrc

 非交互式登陆:

  (1)su UserName
  (2)图形界面下打开的终端
  (3)执行脚本
  (4)任何其它的bash实例
  执行顺序: /etc/profile.d/*.sh --> /etc/bashrc -->~/.bashrc 其中docker就属于此类

按照生效范围划分,存在两类:

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

  全局:/etc/profile, /etc/profile.d/*.sh
  个人:~/.bash_profile
  功用:
  (1)用于定义环境变量
  (2)运行命令或脚本

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

  全局:/etc/bashrc
  个人:~/.bashrc
  功用:
  (1)定义命令别名和函数
  (2)定义本地变量

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章