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

Re: setopt returns both "interactive and login"



On Jun 26, 2006, at 1:56 PM, Timothy Stone wrote:


On Jun 26, 2006, at 1:34 PM, Peter Stephenson wrote:

Timothy Stone wrote:
Can my shell be both 'interactive' and 'login' at the same time?

Yes, that's the normal case for a login shell.

Hmmm... I'm beginning to understand something is occurring behind the scenes here... the *NIX /login/ utility.

So, when I open a new terminal window, with /insert favorite terminal application here/, the /login/ utility is invoked and I get a *login* shell, this is *interactive*. Following that, I request a new shell at the command line, barring the /-l/ switch, I get a new, but /interactive/ shell:
Am I on the right path here?

If you are talking about a terminal window in X, you will (usually, YMMV) get an interactive shell always (because it's a shell waiting for your input at the terminal), but in order to have your terminal window use a login shell you need to specify that as such. For example Gnome-terminal or Konsole have check boxes in their settings you can tick to say you want the shell to be a login, or in xterm (also mrxvt, and some others) you can add -ls to the xterm command line to tell it you want a login shell.

The difference between login and interactive shells is not as noticeable in zsh because of the way zsh handles startup files. Bash, for example, will only source .profile for login shells and .bashrc for all interactive shells (and both for shells that are both login and interactive), but zsh has a very complex (yet very convenient, depending on how you look at it) way of handling the startup files which can make the distinction between login and interactive shells blurry.

One rule that you can keep in mind is that all login shells are going to be interactive but not all interactive shells are login shells (and again, the difference is not so important for zsh afaict).

The "user friendly user guide" and the book "From Bash to Z Shell" both cover this, and are both very helpful (the Bash to Z Shell book especially, if you want to see comparisons between shells).

Hope this helps!

Mike



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