Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash, setting up .profile may not work. #533

Closed
dbuenzli opened this issue Mar 15, 2013 · 3 comments
Closed

Bash, setting up .profile may not work. #533

dbuenzli opened this issue Mar 15, 2013 · 3 comments

Comments

@dbuenzli
Copy link
Contributor

From bash's man page:

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable.

I had a .bash_profile so the setup thing didn't work since in that case .profile is never read. No problem in switching to .profile for me but you may want to do something about that.

@samoht
Copy link
Member

samoht commented Mar 15, 2013

Thanks for raising the issue: indeed automatic setup may not work, because the different shells all have a crazy and different logics, see for instance http://shreevatsa.wordpress.com/2008/03/30/zshbash-startup-files-loading-order-bashrc-zshrc-etc/. And this doesn't even account for gnome and dash init scripts ....

So I guess it will be quite hard to have all this logic right in the auto-setup tool...

In the meantime, you can still manually specify your configuration file:

opam init --dot-profile=~/.bash_profile             
opam config --user --dot-profile=~/.bash_profile

But we should definitely add a note in the documentation about that.

@samoht
Copy link
Member

samoht commented Mar 15, 2013

Actually, we could at least implement the same thing for bash as in zsh:

Moral:
  For bash, put stuff in ~/.bashrc, and make ~/.bash_profile source it.
  For zsh, put stuff in ~/.zshrc, which is always executed.

@avsm
Copy link
Member

avsm commented Mar 16, 2013

The obvious question here is what other languages do. Virtualenv for Python is quite specific to Python, but it would be nice to find something else that can take care of all the shell issues. A search I just did found nothing useful, but I didn't look too hard in the first instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants