正常一般某終端登陸 su - USERNAME su -l USERNAME
su USERNAME 圖形終端下打開命令窗口 自動執行的shell腳本
在說以前首先看咱們的bash的配置文件: 全局配置 /etc/profile, /etc/profile.d/*.sh, /etc/bashrc 我的配置 ~/.bash_profile, ~/.bashrc profile類的文件: 設定環境變量 運行命令或腳本 bashrc類的文件: 設定本地變量 定義命令別名
這就是區別(讀取的文件和順序都不一樣)shell
登陸式shell如何讀取配置文件? /etc/profile --> /etc/profile.d/*.sh --> ~/.bash_profile --> ~/.bashrc --> /etc/bashrc 非登陸式shell如何讀取配置文件? ~/.bashrc --> /etc/basrc --> /etc/profile.d/*.sh