Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Terminal.app has a setting to select with shell it uses, and the default setting is "Default login shell (/usr/bin/login)".
What are the differences between /usr/bin/login and /usr/bin/bash?

share|improve this question
    
In addition to the answers to this question, note that regardless of the preference setting, Terminal always runs /usr/bin/login to create a terminal session. The preference just controls whether it tells login to use your default shell or the custom command. If you look at the Inspector window for an active terminal you’ll see the Running Processes list always begins with login followed by either the default shell or the custom command. –  Chris Page Mar 10 '12 at 19:15
add comment

2 Answers 2

up vote 3 down vote accepted

Griffo is correct. Now in your scenario, the difference boils down to the following:

  1. if you pick /bin/login, then this program will check in the user database what your default shell is and run that shell as a login shell, thereby invoking the rc files that are run only when the shell is run as a login shell (in case of bash those are /etc/profile, ~/.bash_profile, ~/.bash_login and , and ~/.profile.
  2. if you pick /bin/bash, that shell will be executed as a login shell, independently of what shell is set in the user database. This can come in useful when the shell in the user database does not work properly, or you want to be able to use different shells.

As per the comment by Chris Page, the shell is run as a login shell in both cases.

If you have not changed your login shell from the default, which is /bin/bash, and you have not changed the rc files of this shell, then the difference will not be noticeable.

share|improve this answer
    
As far as I am aware #2 is incorrect: Terminal always creates login shells. In fact, if you set it to a command like /usr/bin/emacs it will be invoked as a login process. (The process name is prefixed with -.) I just tried this with both the Leopard and Lion versions of Terminal. –  Chris Page Mar 10 '12 at 19:09
add comment

/usr/bin/login is a program used to login to the system and is not something you invoke manually under normal circumstances. Have a look at the info/man pages by issuing one of the following commands:

info login or man login

/usr/bin/bash is a shell and its job is to interpret input from the user and invoke programs. You can also see more info on bash by using the commands below:

info bash or man bash

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.