可以看到哪些.profile是在bash提示符下获得的吗?
因此,在我遇到的任何新unix变体中,我总是对在哪里查找bash的.profile感到犹豫。对于在我自己的机器上运行的奇怪的bash实例来说,这甚至是真的 不是每次都在互联网上搜索,有没有一种方法可以查看bash中当前加载了哪些.profile 差不多可以看到哪些.profile是在bash提示符下获得的吗?,bash,.bash-profile,Bash,.bash Profile,因此,在我遇到的任何新unix变体中,我总是对在哪里查找bash的.profile感到犹豫。对于在我自己的机器上运行的奇怪的bash实例来说,这甚至是真的 不是每次都在互联网上搜索,有没有一种方法可以查看bash中当前加载了哪些.profile 差不多 $ source --list-sourced 因此,如果您是调用shell的人,只需执行bash-v;矿山的产量始于 $> bash -v # .bashrc # Source global definitions if [ -f /
$ source --list-sourced
因此,如果您是调用shell的人,只需执行
bash-v
;矿山的产量始于
$> bash -v
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
....
这给了你一个很好的开始,关于正在发生的事情,以及去哪里看
如果这不可行,您必须检查bash指定它使用的路径(从manbash
):
当bash作为交互式登录shell或
带有--login选项的非交互式shell,它首先读取和
执行命令
从文件/etc/profile,如果该文件存在。读取该文件后,它将查找~/.bash\u配置文件、~/.bash\u登录名和
~/.profile,在那个
命令,并从第一个存在且可读的命令中读取和执行命令。在以下情况下可以使用--noprofile选项:
贝壳是
开始抑制这种行为
除了$HOME/.profile和朋友?没错。在我的mac上,这将是~/.bash_配置文件,但该配置文件不包括我的整个路径,因此在此之前必须有一些更通用的配置文件。我想以一种简洁的方式查看所有这些文件。/etc/profile和/etc/profile.d/以及来自您的bashrca的文件,bash-v标志在我的情况下没有任何作用,但阅读手册页确实是一种很好的发现方法。谢谢!:听到这个我很高兴!