文章目录

Red Hat Linux 用户基础》中介绍了 RHEL 对 bash 配置文件的设定:

  • 登录 shell 会载入/etc/profile
  • 特定用户的登录 shell 会载入~/.bash_profile
  • 系统中所有交互式 shell 运行时都会载入/etc/bashrc
  • 特定用户的所有交互式 shell 运行时都会载入~/.bashrc

我观察到的 Ubuntu 系统中 bash 配置载入情况与此不同:

  • 登录 shell 会载入/etc/profile
  • 特定用户的登录 shell 会载入~/.profile
  • 系统中所有交互式 shell 运行时都会载入/etc/bash.bashrc
  • 特定用户的所有交互式 shell 运行时都会载入~/.bashrc

此外还观察到 Ubuntu 下有~/.bash_logout文件,尚不清楚它会在什么时候运行。到底是特定用户所有交互式 shell 退出时运行呢?还是特定用户登录 shell 退出时运行呢?

文章目录