Skip to main content
Mark Shackelford
New Participant
Jan 20, 2023 9:20 AM UTC

Newest Bash (GNU bash, version 5.1.0(1)-release (s390x-ibm-zos-gnu) does not call bashrc

We have been using bash GNU bash, version 4.3.46(51)-release (i370-ibm-openedition) which is pretty old.

Just updated to all the new Opensource Rocket tools and the new bash (5.1.0) does not call the .bashrc (or bashrc) anymore.

Switch back to the old version (4.3.46) and it works fine with no other changes.

Any ideas on why I am having this issue?

Potential solutions?
Thanks

Mark Shackelford



------------------------------
Mark Shackelford
Systems Programmer
Dynatrace
Detroit MS US
------------------------------

    7 replies

    Alexander Klochkov
    Rocketeer
    Jan 20, 2023 9:49 AM UTC

    We have been using bash GNU bash, version 4.3.46(51)-release (i370-ibm-openedition) which is pretty old.

    Just updated to all the new Opensource Rocket tools and the new bash (5.1.0) does not call the .bashrc (or bashrc) anymore.

    Switch back to the old version (4.3.46) and it works fine with no other changes.

    Any ideas on why I am having this issue?

    Potential solutions?
    Thanks

    Mark Shackelford



    ------------------------------
    Mark Shackelford
    Systems Programmer
    Dynatrace
    Detroit MS US
    ------------------------------

    Hi Mark Shackelford,

    If bash is an interactive login shell it's expected behavior. You need to use ~/.bash_profile for this purpose.

    You can simply use these lines for ~/.bash_profile

    if [ -f ~/.bashrc ]; then
    	. ~/.bashrc
    fi

    Some details:
    https://linuxize.com/post/bashrc-vs-bash-profile/
    https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files


    Thanks,
    Alexander



    ------------------------------
    Alexander Klochkov
    QA
    Rocket Internal - All Brands
    Vilnius LT
    ------------------------------
    Mark Shackelford
    New Participant
    Jan 23, 2023 7:10 AM UTC

    Hi Mark Shackelford,

    If bash is an interactive login shell it's expected behavior. You need to use ~/.bash_profile for this purpose.

    You can simply use these lines for ~/.bash_profile

    if [ -f ~/.bashrc ]; then
    	. ~/.bashrc
    fi

    Some details:
    https://linuxize.com/post/bashrc-vs-bash-profile/
    https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files


    Thanks,
    Alexander



    ------------------------------
    Alexander Klochkov
    QA
    Rocket Internal - All Brands
    Vilnius LT
    ------------------------------

    Interfactively, bash invokes .profile.

    Non interactive which is where I am having the problem, it does not invoke .profile or .bashrc or bash_profile or bash_login.  Tried them all

    5.1 does not work, the old 4.3 works everytime with no other changes.

    5.1 seems to be broke.



    ------------------------------
    Mark Shackelford
    Systems Programmer
    Dynatrace
    Detroit MS US
    ------------------------------
    Tatiana Balaburkina
    Rocketeer
    Jan 24, 2023 9:21 AM UTC

    Interfactively, bash invokes .profile.

    Non interactive which is where I am having the problem, it does not invoke .profile or .bashrc or bash_profile or bash_login.  Tried them all

    5.1 does not work, the old 4.3 works everytime with no other changes.

    5.1 seems to be broke.



    ------------------------------
    Mark Shackelford
    Systems Programmer
    Dynatrace
    Detroit MS US
    ------------------------------
    Hi Mark,
    I have compared Bash 4.3 and Bash 5 behavior on z/OS and Linux. Only Bash 4.3 for z/OS invokes .bashrc in non-interactive mode and it seems like Bash 4.3 on Linux too, however Bash 5 on both platforms doesn't .bashrc. This behavior is in accordance with the documentation, therefore we don't consider that Bash 5 on z/OS has a bug.

    ------------------------------
    Tatiana Balaburkina
    Engineering Manager
    Rocket Internal - All Brands
    ------------------------------
    Mark Shackelford
    New Participant
    Jan 26, 2023 8:25 AM UTC
    Hi Mark,
    I have compared Bash 4.3 and Bash 5 behavior on z/OS and Linux. Only Bash 4.3 for z/OS invokes .bashrc in non-interactive mode and it seems like Bash 4.3 on Linux too, however Bash 5 on both platforms doesn't .bashrc. This behavior is in accordance with the documentation, therefore we don't consider that Bash 5 on z/OS has a bug.

    ------------------------------
    Tatiana Balaburkina
    Engineering Manager
    Rocket Internal - All Brands
    ------------------------------
    Ok, working as designed. ☹

    How do I get the PATH set if no profiles get invoked?
    That just doesn’t seem right.

    Mark
    Alexander Klochkov
    Rocketeer
    Jan 26, 2023 4:08 PM UTC
    Ok, working as designed. ☹

    How do I get the PATH set if no profiles get invoked?
    That just doesn’t seem right.

    Mark

    HI Mark Shackelford,

    Is this not your case?
    https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell

    Thanks,

    Alex



    ------------------------------
    Alexander Klochkov
    QA
    Rocket Internal - All Brands
    Vilnius LT
    ------------------------------
    Mark Shackelford
    New Participant
    Jan 27, 2023 7:36 AM UTC

    HI Mark Shackelford,

    Is this not your case?
    https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell

    Thanks,

    Alex



    ------------------------------
    Alexander Klochkov
    QA
    Rocket Internal - All Brands
    Vilnius LT
    ------------------------------
    I have tried every combination and permutation of the commands on this page and none of them work.
    With the -l or -t options, it just puts me into a terminal session.
    I just want a good $PATH and execute the command that I send it and return

    None of these do that.

    Mark
    Mark Shackelford
    New Participant
    Jan 27, 2023 3:01 PM UTC

    HI Mark Shackelford,

    Is this not your case?
    https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell

    Thanks,

    Alex



    ------------------------------
    Alexander Klochkov
    QA
    Rocket Internal - All Brands
    Vilnius LT
    ------------------------------
    I have figured out how to make it work.
    You have to set the “~/.ssh/environment variable to have the correct PATH’

    It works now.

    Thanks for pointing me in the right direction.

    Mark