Re: Login Shells

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 04, 2002 at 11:35:33PM -0500, Joshua Melbourne White wrote:
> Can someone explain to me what login shells are and what are the
> difference between them? (BASH, ect.).  Also, on a side note, I would
> like to thank everyone so far for answering all my questions.  This list
> has helped me a lot.

There are different shells (bash, ksh, zsh, tcsh, etc.). All you need
to know here is "use bash" - you have to know bash anyway since lots
of the system is scripted in it, bash is already installed, and bash
is the best one anyhow. (ok, that's going to start an emacs vs. vi
type argument, so I retract - "they are all great and you should try
them and see which one you like" ;-))

There are multiple shells for the same reason there are multiple
window managers, people coded them up and decided they liked one or
the other. bash, zsh, and tcsh are the main ones people use
interactively. ksh mostly seems to exist because it's the standard
shell on some proprietary unixes, and so sometimes people are used to
it or have existing scripts that use it. There's also plain "sh" which
is the original shell, but is basically useless as an interactive
shell.

If you start an instance of any of these shells, the instance can be 
"interactive" or "login"

An interactive shell is one that's connected to a terminal so it
prints a command line prompt and you can type commands by hand.
i.e. you interact with it. A noninteractive shell is normally one
that's running a script.

A login shell is intended to be the first shell that runs when you log
in. All apps that you run post-login are "descendants" of the login
shell. The actual shell program knows that it's a login shell because
of the way the "login" program or gdm/xdm/kdm launches it.  When a
shell finds out that it's a login shell, it does some special things
such as load ~/.bash_profile. So this way you can have scripted
actions that happen only on login, not other times when you run a
shell. Typically you set environment variables in your .bash_profile,
as everything else in the login session will inherit them from the
login shell.

This is a mild oversimplification, because you can force any shell to
think it's the login shell by passing the right command line options
(such as --login) or by telling your X terminal to launch it as a
login shell. But I've never heard of an interesting reason to do this,
really.

Anyhow, aside from stupid shell tricks, any shell that isn't the first
shell run on login is a non-login shell.

Havoc



-- 
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux