[gobolinux-devel] env vars in /etc/zprofile instead of zshrc
Hisham
hisham.hm at gmail.com
Tue Apr 1 16:37:39 NZDT 2008
On Mon, Mar 31, 2008 at 9:23 PM, Jonatan Liljedahl <lijon at kymatica.com> wrote:
>
> Hisham wrote:
> > On Mon, Mar 31, 2008 at 8:44 PM, Jonatan Liljedahl <lijon at kymatica.com> wrote:
> >> At least mine *does* read zprofile in interactive shells: I put echo
> >> lines at the end of my .zshrc and .zprofile and when I now launch an
> >> xterm -ls I get this:
> >>
> >> reading .zprofile
> >> reading .zshrc
> >> lijon at Kymatix ~]
> >
> > Yes, but -ls turn on "login shell", so that's why .zprofile was read, isn't it?
>
> Yes, of course. I now see the confusion, what I was arguing against was
> the idea that interactive login shells didn't read zprofile, but perhaps
> nobody was saying this... :)
>
> An interactive non-login shell wouldn't read zprofile, that's right. But
> I'm having a hard time seeing why you would need environment variables
> without beeing logged in. And how often do you use an interactive
> non-login shell that is not started from another login shell, and need
> the env variables? "Display manager straight into X" (without login) is
> not something you would want, since the env variables wouldn't be there
> and many things wouldn't work. regardless if they are set in zprofile or
> zshrc. (zshrc is *not* always read, only on interactive shells, which a
> display manager login shell is not.
>
> This thread is starting to get ridiculous.. :)
No, this thread is not ridiculous -- esac is! :)
Getting this kind of shell stuff 100% right is complicated business
and threads like this are valuable because each participant brings
different aspects of knowledge to the table.
> All I want is that login
> shells should have the proper env vars set, regardless of whether the
> shell is interactive (text prompt) or not.
It's fair. I too find it hard to imagine a shell running that didn't
have any (grand^n for n >= 0)-parent process that was a login shell.
My suggestion: how about this? (pseudo-shell ahead: )
zprofile:
export ZPROFILE_SET=1
# export PATH and other env vars...
zshrc:
if [ ! "$ZPROFILE_SET" = "1" ]
then
source zprofile
fi
# other interactive shell stuff: prompt style, completion, etc.
I think this should make everyone happy, no?
-- Hisham
More information about the gobolinux-devel
mailing list