From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29163 invoked by alias); 15 Aug 2011 00:13:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16231 Received: (qmail 2953 invoked from network); 15 Aug 2011 00:12:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110814171249.ZM19893@torch.brasslantern.com> Date: Sun, 14 Aug 2011 17:12:48 -0700 In-reply-to: Comments: In reply to TJ Luoma "[[ -o interactive ]] vs if [[ -o login ]]?" (Aug 14, 6:46pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: [[ -o interactive ]] vs if [[ -o login ]]? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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. --