zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: [[ -o interactive ]] vs if [[ -o login ]]?
Date: Sun, 14 Aug 2011 17:12:48 -0700	[thread overview]
Message-ID: <110814171249.ZM19893@torch.brasslantern.com> (raw)
In-Reply-To: <CADjGqHtVSHJbdrHfJVR9T0uZ0my-Xb396-3k_ZA_fZgD24phdA@mail.gmail.com>

On Aug 14,  6:46pm, TJ Luoma wrote:
}
} if [[ -o interactive ]]
} if [[ -o login ]]
} 
} Are they two ways of saying the same thing? If not, could someone
} explain the difference?

Unless someone is playing games with the command-line switches when
starting zsh: 

[[ -o interactive ]] is always true when [[ -o login ]] is true.

But

[[ -o login ]] is NOT always true when [[ -o interactive ]] is true.

(That is, you can forcibly "zsh -o nointeractive -o login" but that
will never happen in ordinary usage.)

As far as the shell itself is concerned, the only difference is in
whether the ~/.zlogin and ~/.zlogout files are read at startup and
normal exit, respectively.  (And their /etc/ counterparts, too.)

At a larger level, it's usually the case that login shells are those
started directly by the OS when a user logs in on a terminal, whereas
interactive shells are those started indirectly from a login shell.
The advent of windowing systems, however, often means that there is
no single login shell and it's up to the configuration of the terminal
emulator whether a shell started in a window behaves as a login shell.

The intent is that certain environment setup can be done once when the
user first logs in, and then not done again.  Under a windowing system,
the session manager is usually responsible for that one-time setup, but
for remote shells it may still be useful to have the shell do it.

Typically login shells have an entry in the utmp database (the output
of the "who" command) and other shells do not, but again that's up to
the process that started the shell, not the shell itself.

-- 


  parent reply	other threads:[~2011-08-15  0:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-14 22:46 TJ Luoma
2011-08-14 23:24 ` Mikael Magnusson
2011-08-14 23:25 ` Michael Shick
2011-08-14 23:28 ` Vincent Lefevre
2011-08-14 23:44   ` TJ Luoma
2011-08-15  0:12 ` Bart Schaefer [this message]
2011-08-15  1:28   ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110814171249.ZM19893@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).