From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5615 invoked from network); 10 Aug 1998 04:00:30 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 10 Aug 1998 04:00:30 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id XAA05264; Sun, 9 Aug 1998 23:49:02 -0400 (EDT) Resent-Date: Sun, 9 Aug 1998 23:48:52 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980809205100.ZM24722@candle.brasslantern.com> Date: Sun, 9 Aug 1998 20:51:00 -0700 In-Reply-To: <19980809210204.33286@astaroth.nit.gwu.edu> Comments: In reply to Sweth Chandramouli "Re: Re: init files" (Aug 9, 9:02pm) References: <19980809150805.47993@astaroth.nit.gwu.edu> <980809150442.ZM21544@candle.brasslantern.com> <19980809210204.33286@astaroth.nit.gwu.edu> X-Mailer: Z-Mail (4.0b.820 20aug96) To: Sweth Chandramouli , ZSH Users Subject: Re: init files MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"LDgRM3.0.mH1.Zscpr"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1716 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Aug 9, 9:02pm, Sweth Chandramouli wrote: } Subject: Re: Re: init files } } regardless, here is my revised list of tests for the sourcing of } the various rc files. [...] do these look right, or } am i missing anything else? They're all more complicated than they need to be. The tests zsh does are very simple: [1] Is RCS unset? [2] Is LOGIN set? [3] Is INTERACTIVE set? Everything else you include in your lists simply determines the state of those three options. } for one, does it make sense for the precedence of `unsetopt RCS' to be } different from that of `setopt RCS' in test one? everywhere else, the } inversions of options seem to have the same precedence as each other. I don't quite understand what you mean by "precedence." Any setopt or unsetopt that happens in /etc/zshenv can change the command line options, except for -i/+i. The command line options can change the defaults or the values determined by tests like isatty(0). That's all there is. If you mean that the lists under each of your test numbers are supposed to be in some sort of order, then you have the order wrong. [1] DEFAULT--rc-enabled shell => RCS unless `-f' flag present on shell invocation => NO_RCS unless `+f' flag present on shell invocation => RCS unless ( `unsetopt RCS' called in /etc/zshenv => NO_RCS or `setopt RCS' called in /etc/zshenv => RCS ) [2] DEFAULT--non-login shell => NO_LOGIN unless first character of argv[0] is `-' => LOGIN unless ( `+l' flag present on shell invocation => NO_LOGIN or `-l' flag present on shell invocation => LOGIN ) unless ( `unsetopt LOGIN' called before test => NO_LOGIN or `setopt LOGIN' called before test => LOGIN ) [3] DEFAULT--non-interactive shell => NO_INTERACTIVE unless stdin is a tty (isatty(0) is true) => INTERACTIVE unless script name present on shell invocation => NO_INTERACTIVE unless `-s' flag present on shell invocation => INTERACTIVE *and* stdin is a tty unless `-c' flag present on shell invocation => NO_INTERACTIVE unless ( `-i' flag present on shell invocation => INTERACTIVE or `+i' flag present on shell invocation => NO_INTERACTIVE ) Note that there are two "oddities" here: First, +f always wins over -f when both appear, no matter in what order; for all the other flags, whichever one comes last wins. I don't know why this is. Second, +s cannot unset SHINSTDIN when there is no other possible source of input, which is why I listed "script name present" instead of +s. } secondly, is there any way to ensure that an action will be taken for all } users upon logout? Not really; you summed up the situation accurately. } finally, what is the purpose of the `+i' flag? } `zsh +i' doesn't spawn a non-interactive shell (which would, i would } imagine, immediately exit without some source of input), but instead } spawns a shell where the only option set is SHIN_STDIN, but which is } still interactive (and which ignores PROMPT, it seems). You're confusing "interactive" with "reads from the tty." A shell that doesn't prompt is not "interactive." It's reading commands from stdin, and stdin happens to be a tty, but the shell doesn't care. You'll note that it doesn't do other interactive things either, e.g., it ignores the CORRECT option, it won't let you setopt ZLE, and if you type ctrl-Z you suspend the whole shell. As for what the purpose is, well, I can come up with only rather far- fetched examples of cases when you might use it, but it's there just in case. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com