• Profile order

    From Bitfox@21:1/5 to All on Sat Nov 30 23:10:01 2024
    If /etc/profile and home dir’s .bash_profile have included the same
    command but with different arguments. Which one will be used then? Thank
    you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From eben@gmx.us@21:1/5 to Bitfox on Sat Nov 30 23:10:01 2024
    On 11/30/24 17:02, Bitfox wrote:
    If /etc/profile and home dir’s .bash_profile have included the same command but with different arguments. Which one will be used then? Thank you.

    I think /etc/profile gets called first, but this is definitely a time for a diagnostic echo or two.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Smith@21:1/5 to Bitfox on Sat Nov 30 23:30:01 2024
    Hi,

    On Sun, Dec 01, 2024 at 06:02:42AM +0800, Bitfox wrote:
    If /etc/profile and home dir’s .bash_profile have included the same command but with different arguments. Which one will be used then? Thank you.

    Your question doesn't make a lot of sense since, as it is posed, in any situation where both files would be processed, *commands* that are in
    both would *both* be executed.

    However you probably meant to ask about things like variable settings,
    aliases and function definitions, which are things that can override
    earlier ones of the same name.

    Note that which files are considered depends on what kind of shell
    session is being launched, that is whether it is interactive or not, and whether it is a login shell or not. This is further complicated by
    desktop environments, which may choose one or the other way or can be configured differently, so one really has to check.

    Anyway, /etc/profile and ~/.bash_profile are normally only executed for interactive, login shells. In any case where both would be executed, /etc/profile is first, and .bash_profile would then override any prior
    setting.

    If in doubt it is easy enough to test by putting something in them like

    export DEBUG_FILE_ORDER="This is /etc/profile"

    export DEBUG_FILE_ORDER="This is .bash_profile"

    etc.

    etc and see what it ends up as.

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)