On Tue, Apr 1, 2008 at 5:39 PM, Jonas Karlsson <[EMAIL PROTECTED]> wrote: > > On Tue, 01 Apr 2008 05:37:39 +0200, Hisham <[EMAIL PROTECTED]> wrote: > > > On Mon, Mar 31, 2008 at 9:23 PM, Jonatan Liljedahl <[EMAIL PROTECTED]> > wrote: > >> > >> Hisham wrote: > >> > On Mon, Mar 31, 2008 at 8:44 PM, Jonatan Liljedahl <[EMAIL PROTECTED]> > 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 > >> >> [EMAIL PROTECTED] ~] > >> > > >> > 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... :) I think that was it, yeah - shells can be any combination of login/not login and interactive/noninteractive, so shells that are both login and interactive *do* source zprofile. > >> 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? > > > Atually, I think a solution was given in the zsh user's guide posted > earlier: > > * So, at the absolute least, you should probably surround any option > * settings in /etc/zshenv with > * if [[ ! -o norcs ]]; then > * ... <commands to run if NO_RCS is not set, > * such as setting options> ... > * fi I prefer Hisham's way: it's less processing and less error-prone. The [[ -o norcs ]] test is more meant for setting shell options (SH_WORD_SPLIT, say), which a script might want to know are in their default state. There are a lot of subshells opened all the time that have to parse zshenv. Only interactive shells will need to do any extra processing at all this way.
The skeleton ~/.zshrc will have to source ~/.zprofile as well. -Michael _______________________________________________ gobolinux-devel mailing list gobolinux-devel@lists.gobolinux.org http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel