如果我在另一个 shell 中运行一个 shell,将加载哪个配置文件链?

huangapple go评论48阅读模式
英文:

what profiles chain will be loaded if I run a shell in another shell?

问题

我知道有分类规则可以解释这个,就像下面的图片一样。
加载配置链的规则
但在我的测试中,似乎它不属于任何一个规则,如果我在普通Shell内运行另一个Shell。

userName 在 ZSH 中 $: echo 感谢答案 & bash
感谢答案
(/etc/profile 中的脚本没有运行)
userName 在 Bash 中 $:
英文:

I know there are rules of classification to explain this like the image below.
loading rules of profiles chain
But in my tests, it seems like it belong to none of them that if I run into another shell inside a normal shell.

userName is in ZSH $: echo thanks to anwsers & bash
thanks to anwsers
(scripts in /etc/profile didn't run)
userName is in Bash $:

答案1

得分: 0

这与在zsh中执行bash无关。没有任何选项的bash启动非登录shell,而/etc/profile仅由登录shell源。如果您明确要求使用bash -l启动登录shell,它将源自/etc/profile

英文:

This has nothing to do with bash being executed from zsh. bash with no options starts a non-login shell, while /etc/profile is only sourced by login shells. If you explicitly request a login shell with bash -l, it will source /etc/profile.

huangapple
  • 本文由 发表于 2023年3月15日 19:34:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744144.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定