关于ubuntu 用户切换的细节 su - user 和su user

只在「登录交互式 shell」(login shell)时执行
/etc/profile 会去跑 /etc/profile.d/*.sh。

如果你用 su seed,默认启动的是 非登录 shell,不会跑 /etc/profile,自然也不会加载 /etc/profile.d/conda.sh。

如果你用 su - seed(注意 -),这是登录 shell,就会加载 /etc/profile → /etc/profile.d/*.sh,PATH 就会更新。

posted @ 2025-09-25 16:39  学不会xuebuhui  阅读(15)  评论(0)    收藏  举报
Language: javascript //图片预览