0

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 $:
  • One comment on that image. `/etc/bash.bashrc` is disabled by default; you need to uncomment a line in the `bash` source code and recompile to enable it. – chepner Mar 15 '23 at 11:47
  • What is a _profile chain_? What is a "normal" shell (respectively what would be a "unnormal" shell)? The startup files are dependent on the kind of shell (login-shell vs. non-login shell, interactive vs. non-interactive shell), and this can also be further influenced by certain environmentvariables depending on the type of shell. In the case of bash, the rules for the game are defined in the chapter _INVOCATION_ in the bash man-page. – user1934428 Mar 15 '23 at 16:40

1 Answers1

0

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.

chepner
  • 497,756
  • 71
  • 530
  • 681