Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: All login shells are interactive?

On Sun, Oct 13, 2002, Philippe Troin wrote about "Re: All login shells are interactive?":
> alnesbit@xxxxxxxxxxxxxxxx writes:
> > That's what the FAQ says, but I don't understand how this can be true.
> > Surely you can have a non-interactive login shell, like, say
> > 
> >     zsh -l -c 'echo Non-interactive login shell'
> Yes indeed. And it is used by at least gnome-session and CDE when you
> start an X session.

Right. I even use this trick myself: my ~/.xsession file starts with a

	#!/bin/zsh -l

line, so that it (and everything in it) gets run after zsh has read my
~/.zprofile, including all my enviroment variables (e.g., my PATH).

This is why when I wanted my .zprofile to print a welcome message only
for interactive login shells, I did something like this in .zprofile:

# We print this message only in a shell which is both interactive and a login
# shell. Alternatively we can move this message to zshrc, inside a test if $-
# contains l (i.e., a login shell). 
case $- in
    print -P "Welcome to %m, %D{%A}, %D{%e %B %Y}, %t.";;

Nadav Har'El                        |      Sunday, Oct 13 2002, 8 Heshvan 5763
nyh@xxxxxxxxxxxxxxxxxxx             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Always remember you're unique, just like
http://nadav.harel.org.il           |everyone else.

Messages sorted by: Reverse Date, Date, Thread, Author