Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
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:
[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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author