|
Home > Archive > Unix Shell > May 2007 > Benefits of login shell
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Benefits of login shell
|
|
| Hans Aberg 2007-05-19, 1:20 pm |
| What is the benefit, other than the formal differences, of using a login
shell vs. not using it? - Mac OS X has two consoles, "Terminal" creating a
login shell and 'xterm' not creating it (in 'bash'), both typically opened
after the GUI login, and it is easy to change it.
Hans Aberg
| |
| Barry Margolin 2007-05-20, 1:21 am |
| In article <haberg-1905071829240001@c83-250-192-69.bredband.comhem.se>,
haberg@math.su.se (Hans Aberg) wrote:
> What is the benefit, other than the formal differences, of using a login
> shell vs. not using it? - Mac OS X has two consoles, "Terminal" creating a
> login shell and 'xterm' not creating it (in 'bash'), both typically opened
xterm will create a login shell if you give it the -ls option.
> after the GUI login, and it is easy to change it.
A login shell will run the .profile startup script to initialize
environment variables for the login session.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Hans Aberg 2007-05-20, 7:19 am |
| In article <barmar-EE5BDC.22234519052007@comcast.dca.giganews.com>, Barry
Margolin <barmar@alum.mit.edu> wrote:
>
> xterm will create a login shell if you give it the -ls option.
>
>
> A login shell will run the .profile startup script to initialize
> environment variables for the login session.
Thank you, Barry, but those are the formal differences. If I turn off the
login shell, but otherwise use the same startup (but from a different
file), will I loose anything?
[In order to get the Unicode locale working in Terminal, I have in
Preferences -> Execute this command put
_ /usr/bin/env LC_CTYPE=UTF-8 /bin/bash -l
If I do not want the login shell, I just take away the -l. (In latest
xterm, it suffices to just put 'export LC_CTYPE=UTF-8' somewhere in the
startup.)]
Hans Aberg
| |
| Barry Margolin 2007-05-20, 1:23 pm |
| In article <haberg-2005071049170001@c83-250-192-69.bredband.comhem.se>,
haberg@math.su.se (Hans Aberg) wrote:
> In article <barmar-EE5BDC.22234519052007@comcast.dca.giganews.com>, Barry
> Margolin <barmar@alum.mit.edu> wrote:
>
>
> Thank you, Barry, but those are the formal differences. If I turn off the
> login shell, but otherwise use the same startup (but from a different
> file), will I loose anything?
The point is that some shells don't run ANY startup script automatically
if they're not a login shell. Bash runs the script named in $ENV, but
you usually need to set that variable in another startup script -- it
will then be used by descendant shells.
> [In order to get the Unicode locale working in Terminal, I have in
> Preferences -> Execute this command put
> _ /usr/bin/env LC_CTYPE=UTF-8 /bin/bash -l
> If I do not want the login shell, I just take away the -l. (In latest
> xterm, it suffices to just put 'export LC_CTYPE=UTF-8' somewhere in the
> startup.)]
If you have an alternate, system-specific way to initialize variables
then you don't need to worry about the login shell distinction. It's
mainly a remnant from the days of ASCII terminals with a single login
session. It's harder to fit into the multi-window modern environment,
where shell windows are not typically descendants of an initial shell
(they usually descend from the window manager).
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Hans Aberg 2007-05-20, 1:23 pm |
| In article <barmar-2C673F.10513120052007@comcast.dca.giganews.com>, Barry
Margolin <barmar@alum.mit.edu> wrote:
>
> The point is that some shells don't run ANY startup script automatically
> if they're not a login shell. Bash runs the script named in $ENV, but
> you usually need to set that variable in another startup script -- it
> will then be used by descendant shells.
OK. Fine.
> If you have an alternate, system-specific way to initialize variables
> then you don't need to worry about the login shell distinction. It's
> mainly a remnant from the days of ASCII terminals with a single login
> session. It's harder to fit into the multi-window modern environment,
> where shell windows are not typically descendants of an initial shell
> (they usually descend from the window manager).
There is such a method on Mac OS X: one can use a file
~/.MacOSX/environment.plist.
I just compiled that latest C-version of Modules <comp.sys.mac.system>
under Mac OS 10.4.9 (latest). All I had to do is to add an option '-lX11'
to the last gcc linking command, which otherwise fails. I haven't checked
if it works, though.
Hans Aberg
| |
| Hans Aberg 2007-05-20, 7:21 pm |
| In article <barmar-EE5BDC.22234519052007@comcast.dca.giganews.com>, Barry
Margolin <barmar@alum.mit.edu> wrote:
>
> xterm will create a login shell if you give it the -ls option.
Detail: One can start X Window programs without a console, for example
from the X11 "File" menu, in which case .bashrc will be executed, not
..profile. So this lessens the point of making xterm a login shell.
Hans Aberg
|
|
|
|
|