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

Re: ideas, questions, and bugs (?)



TGAPE! <tgape@xxxxxxxxxxxxxxxxxxxxxxxxx> writes:

> >>           Also, is it better to stick vars in zlogin and export them so future
> >> shells inherit them, or put things like PATH, MANPATH, HOSTNAME, etc. in
> >> zshenv?
> >
> > Put them in zshenv, and export if appropriate.
> 
> Be sensible.  EDITOR, HISTFILE, HISTSIZE, LESS, PAGER, VISUAL, and other
> such environment variables shouldn't be in zshenv - they can only be
> used in interactive shells.  Of course, setting every environment

Do you mean they belong in .zlogin?  In my experience, this doesn't work very
well in a networked environment, consider:

    rsh thathost xterm -display thishost:0.0

The shell running inside xterm is interactive, but it's not a login shell, so
it won't have EDITOR, HISTFILE, etc. which is probably not what you want.  Of
course, you can use "xterm -ls", but not everybody uses xterm and terminal
emulators such as shelltool don't have a similar option.

> variable I set takes less than a second; it doesn't hurt *that* much
> unless you have a *lot* of shell scripts that read /etc/zshenv.

I agree with this.  In practice, I find it's easier to put all this stuff in
/etc/zshenv or ~/.zshenv and leave ~/.zlogin for things that are *strictly*
part of logging in, starting X for example.

> (I do - my zshenv contains all of my setopts in it, and most zsh scripts
> want them.)
> 
> Question: would it be possible to avoid this whole problem by re-writing
> /sbin/init as a zsh script?  That way, it can export all of the variables,
> and so you don't need to worry about cron-executed programs having a
> different environment.

What about environment variables set in ~/.zshenv?  Why not just put "zsh -l"
in your crontab?

-- 
Tim Writer                                              Tim.Writer@xxxxxxxxxx
FTL Solutions Inc.
Toronto, Ontario, CANADA



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