-
Notifications
You must be signed in to change notification settings - Fork 390
default bash environment setup only configures interactive shells #1447
Description
Right now, opam init -a --bash (well, not exactly, --bash doesn't exist) writes to ~/.bashrc if ~/.bash_profile doesn't exist. If the shell is unknown, ~/.profile is used.
The fundamental difference between ~/.bashrc and ~/.bash_profile/~/.profile is that the latter are run for all login shells whereas the former is run for interactive shells. The profile files usually execute ~/.bashrc but ~/.bashrc contains
# If not running interactively, don't do anything
[ -z "$PS1" ] && returnusually near the top. Because opam appends its session configuration to the end of the interactive shell initialization, only interactive sessions are configured for opam.
This is painful when trying to use opam binaries via ssh like
ssh host "bash -l -c \"ocamlfind list\""If ~/.bash_profile does not exist, should opam just create it? If ~/.profile exists, should opam just append its configuration to that?
Configuring for only interactive shells by default seems a little broken.