You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At least on my machine (Fedora 29), ~/.opam/opam-init/env_hook.sh is not executed from init.sh when called from .bash_profile. The resaon is that it seems like .bash_profile is executed once when I open my user session, and stdout is not bound to a terminal at that time.
Hence, the test
if [ -t 0 ]; then
test -r /home/jjourdan/.opam/opam-init/complete.sh && . /home/jjourdan/.opam/opam-init/complete.sh > /dev/null 2> /dev/null || true
test -r /home/jjourdan/.opam/opam-init/env_hook.sh && . /home/jjourdan/.opam/opam-init/env_hook.sh > /dev/null 2> /dev/null || true
fi
is ignored.
The text was updated successfully, but these errors were encountered:
Shell startup loading can be nonsensical sometimes, and quite difficult to raise a general usability consensus (cf. #1447, #533, etc.).
You can change the default configuration file to update, and set it up as .bashrc or another setup file, to be sure to have at each terminal opening, with opam init --reinit.
Yes, I already added the correct call in .bashrc in my configuration. I just think it is sad that people continue typing eval $(opam env) while shell hooks exist and can be made working.
More precisely : in many cases, if using a graphical interface (i.e., there is no actual "login shell"), .bash_profile will be run in a non-interactive context at login time, and shell hooks will not be setup. So, if we want them to be setup reliably, perhaps the right thing to do is to call variables.sh from .bash_profile and complete.sh and env_hook.sh from .bashrc. Don't you think?
If variables.sh is in .bash_profile, it will only be run once at session opening, and new non login shells won't be updated if the shell hook is not enabled.
At least on my machine (Fedora 29),
~/.opam/opam-init/env_hook.sh
is not executed frominit.sh
when called from.bash_profile
. The resaon is that it seems like.bash_profile
is executed once when I open my user session, and stdout is not bound to a terminal at that time.Hence, the test
is ignored.
The text was updated successfully, but these errors were encountered: