Zsh Mailing List Archive
Messages sorted by:
Re: init files
- X-seq: zsh-users 1716
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sweth Chandramouli <sweth@xxxxxxxxxxxxxxxxxxxx>, ZSH Users <zsh-users@xxxxxxxxxxxxxxx>
- Subject: Re: init files
- Date: Sun, 9 Aug 1998 20:51:00 -0700
- In-reply-to: <19980809210204.33286@xxxxxxxxxxxxxxxxxxxx>
- References: <19980809150805.47993@xxxxxxxxxxxxxxxxxxxx> <980809150442.ZM21544@xxxxxxxxxxxxxxxxxxxxxxx> <19980809210204.33286@xxxxxxxxxxxxxxxxxxxx>
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:
 Is RCS unset?
 Is LOGIN set?
 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.
 DEFAULT--rc-enabled shell => RCS
`-f' flag present on shell invocation => NO_RCS
`+f' flag present on shell invocation => RCS
( `unsetopt RCS' called in /etc/zshenv => NO_RCS
`setopt RCS' called in /etc/zshenv => RCS )
 DEFAULT--non-login shell => NO_LOGIN
first character of argv is `-' => LOGIN
( `+l' flag present on shell invocation => NO_LOGIN
`-l' flag present on shell invocation => LOGIN )
( `unsetopt LOGIN' called before test => NO_LOGIN
`setopt LOGIN' called before test => LOGIN )
 DEFAULT--non-interactive shell => NO_INTERACTIVE
stdin is a tty (isatty(0) is true) => INTERACTIVE
script name present on shell invocation => NO_INTERACTIVE
`-s' flag present on shell invocation => INTERACTIVE
*and* stdin is a tty
`-c' flag present on shell invocation => NO_INTERACTIVE
( `-i' flag present on shell invocation => INTERACTIVE
`+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
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: