我有多个 .bash_profile 副本,实际使用的是哪一个?(如果有的话)

T-b*_*use 12 shell bashrc

我想在某些时候我搞砸了我.bash_profile现在有多个。我正在尝试自定义我的外壳,但我不确定.bash_profile要使用哪个,如果有的话。我认为.bashrc文件更常用?

我正在运行 OSX - El Capitan

ls -la | more
total 480


-rw-------    1 Matthew  staff   6404 Feb 16 23:57 .bash_history
-rw-r--r--    1 Matthew  staff    719 Jan 19 20:18 .bash_profile
-rw-r--r--    1 Matthew  staff    335 Oct  7 12:35 .bash_profile.macports-saved_2017-01-19_at_20:18:05
-rw-r--r--    1 Matthew  staff    167 Jul 16  2015 .bash_profile.pysave
drwxr-xr-x  208 Matthew  staff   7072 Feb 18 19:41 .bash_sessions
Run Code Online (Sandbox Code Playgroud)

Kus*_*nda 35

不,你只有一个,它叫做.bash_profile。Bash 不会读取带有附加后缀的那些。

其他.bash_profile.*文件看起来像备份,可能由不同的软件安装(从去年和前年)。如果您愿意,请diff -u在您.bash_profile和其他人之间(依次)运行 a以查看他们的不同之处,例如

$ diff -u .bash_profile .bash_profile.pysave
Run Code Online (Sandbox Code Playgroud)

.bashrc由交互式 shell.bash_profile使用,用于登录 shell。如果要添加别名,请将它们添加到.bashrc.

另请参阅“ ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc ... 之间有什么区别?