I have a .bashrc that sets PATH, and also sources another file that extends said variable and defines new ones. Looks like in bash opened via IDEA terminal, the PATH extension from this sourced configuration file are not applied.


    if [[ "$ENV_LOADED" != "loaded" ]]; then
        source .extra-conf

    export PATH="/mypath:$PATH"


    for i in \
            "$HOME/bin" \
            /sbin \
        if [[ -d "$i" && :$PATH: != *:"$i":* ]]; then
    [[ -n "$j" ]] && export PATH="${j}$PATH"
    unset i j

    export OTHER_VAR=value1

    # marker var used to detect whether env vars have been loaded:
    export ENV_LOADED=loaded

Note PATH will contain /mypath, and OTHER_VAR from .extra-conf is available as well. But all the PATH extensions from .extra-conf are missing. This only happens in IDEA, in other terminals outside of it all is good.

What exactly is going on here? Obviously .extra-conf has been sourced, otherwise OTHER_VAR wouldn't be defined - so why isn't PATH updated?


following Kamil's comment, surrounding the if block in set -x, the output was

+++ [[ loaded != \l\o\a\d\e\d ]]
+++ set +x
++ [[ loaded != \l\o\a\d\e\d ]]
++ set +x

There are more things wrong with that terminal session - ssh keys are not unlocked either, as these are printed:

Could not open a connection to your authentication agent.
Could not open a connection to your authentication agent.

Note keys should be unlocked by gnome-keyring-daemon, executed from .xinitrc:

eval $(/usr/bin/gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)

Looks like this is caused by SSH_AUTH_SOCK env var being missing in IDEA's terminal.

  • Invoke bash -x. Or put set -x in .bashrc before if, and set +x after fi; then spawn a new shell and see what happens. Aug 9, 2019 at 8:58
  • @KamilMaciorowski good idea; the check doesn't pass; although it is called twice for some reason: line1: +++ [[ loaded != \l\o\a\d\e\d ]] line2: +++ set +x line3: ++ [[ loaded != \l\o\a\d\e\d ]] line4: ++ set +x
    – basher
    Aug 9, 2019 at 9:04


You must log in to answer this question.

Browse other questions tagged .