Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'new Terminal windows run "login shells"' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
new Terminal windows run "login shells"
Authored by: hayne on Feb 22, '05 06:22:00PM
Whenerver you open a new terminal window in OS X, you are invocating your shell implicitly as an interactive shell. Logout in this circumstance just doesn't make any sense - speaking from a unix standpoint of view.
Actually, each new Terminal window starts a "login shell". You can see this by looking at the parent process of the shell - it is 'login'. This is important to know because it means that, for example, bash does not read the ~/.bashrc file when a new Terminal window is opened, but it does read the ~/.profile file (see 'man bash').

And this is the reason why typing 'logout' in a Terminal window will close that window, while 'exit' merely quits the shell and leaves the window open. If you start a sub-shell by typing 'bash' in a Terminal window, then that sub-shell is a non-login shell and so 'logout' gives you an error message.

In contrast, a new xterm window starts a non-login shell.

[ Reply to This | # ]

new Terminal windows run "login shells"
Authored by: PeteVerdon on Mar 12, '05 04:48:07PM

> 'exit' merely quits the shell and leaves the window open

Not on my machine, it doesn't. I always use exit to close a terminal window, because I didn't log in to it and so that's what feels natural after years of Unix. logout also works, as a convenience, but I don't use it in local windows.

Pete



[ Reply to This | # ]