英文:
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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论