摘录自 StackExchange:
/etc/profile
and ~/.profile
for Bourne compatible shells (and /etc/profile.d/*
)~/.bash_profile
for bash/etc/zprofile
and ~/.zprofile
for zsh/etc/csh.login
and ~/.login
for csh/etc/bashrc
and ~/.bashrc
for bash$PS1
). Sourced files:/etc/profile
and ~/.profile
/etc/bashrc
or /etc/bash.bashrc
for bash/etc/bashrc
or /etc/bash.bashrc
for bash (but, mostly you see this at the beginning of the script: [ -z "$PS1" ] && return
. That means don't do anything if it's a non-interactive shell)$ENV
variable