无法在没有 .zshrc 的情况下获取 .profile

发布于 2024-07-21 22:29:14 字数 229 浏览 4 评论 0原文

我的 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

查看 Zsh 手册,其中提到使用 ~/。 zprofile 而不是 ~/.profile

Look in the Zsh manual where it says to use ~/.zprofile instead of ~/.profile.

我们只是彼此的过ke 2024-07-28 22:29:14

除了 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文