无法在没有 .zshrc 的情况下获取 .profile
我的 .zshrc 中有以下几行,
source /etc/profile
source $HOME/.profile
如果没有它们,我的 .profile 不会加载,尽管在 Unix 系统中默认情况下应该加载 .profile。
如何在不从 .zshrc 获取 .profile 的情况下加载 .profile?
I have the following lines in my .zshrc
source /etc/profile
source $HOME/.profile
My .profile is not loaded without them, although .profile should be loaded by default in Unix systems.
How can you load .profile without sourcing it at .zshrc?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看 Zsh 手册,其中提到使用
~/。 zprofile
而不是~/.profile
。Look in the Zsh manual where it says to use
~/.zprofile
instead of~/.profile
.除了 Martin 关于 zprofile 与 profile 的说法之外,还请注意,仅当 zsh 作为登录 shell 启动时才会读取 /etc/zprofile 和 ~/.zprofile。 如果它“只是”一个交互式 shell,它只会读取 .zshrc。 所以问题是你如何启动 zsh。 如果您使用 Gnome 终端之类的东西,您可以在配置文件首选项中设置 shell 应作为登录 shell 启动。
更多信息:Z-Shell 用户指南
In addition to what Martin says about zprofile vs profile, also note that /etc/zprofile and ~/.zprofile are only read when zsh is started as a login shell. If it is "just" an interactive shell, it will only read .zshrc. So the question is how you are starting the zsh. If you use something like Gnome Terminal, you can set in the Profile Preferences that the shell should be started as a login shell.
More info: Z-Shell User's Guide