答案1
没有.bash_profile是正常的吗?
是的 -/etc/skel
创建帐户时复制的默认文件adduser
是:
$ ls -A /etc/skel
.bash_logout .bashrc .config .kshrc .mkshrc .profile Templates
可以看到,有default,.bash_logout
但是没有default .bash_profile
。
如果我手动创建它可以吗?
是的,没问题 - 请注意,如果您这样做,它将优先于文件读取~/.profile
- 来自INVOCATION
以下部分man bash
:
When bash is invoked as an interactive login shell, or as a non-inter‐ active shell with the --login option, it first reads and executes com‐ mands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
因此您可能希望~/.profile
从新的来源获取信息~/.bash_profile
以维护它提供的任何功能。