What does "Run command as a login shell" do?

I have a few separate programs installed, some of which require me to go into my GUI terminal settings and enable/disable the "Run command as a login shell" option to get either working.

Example:

I installed Ruby on Rails. Unfortunately I have to go into the terminal options and enable "Run command as login shell" for it to be in my PATH.

This wasn't too much of an issue up until I installed sexy-bash-prompt, which works only if the option is disabled.

So my question is essentially: what does "Run command as login shell" do? Is there a way to get the things that run when it's disabled to run when you do run as login shell?

1 Answer

Assuming that your shell is Bash (the default in Ubuntu), these are the differences:

  • When running as a login shell, Bash will read ~/.bash_profile (or, if that doesn't exist, ~/.profile) on startup. In some cases, this file reads ~/.bashrc as well.

  • When running as a non-login shell, Bash will read ~/.bashrc.

So, why do you see different behaviors when running as a login/non-login shell? Because your .bash_profile/.profile is doing different things than your .bashrc.

The solution I would recommend in your case is to copy the customizations made to .bash_profile/.profile, paste them into .bashrc and disable "Run command as a login shell".

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like