zsh-users
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Chris Johnson <cjohnson@cs.utk.edu>
Cc: zsh-users@sunsite.dk
Subject: Re: Where PATH is set
Date: Tue, 5 Sep 2006 23:16:57 -0700	[thread overview]
Message-ID: <20060906061657.GA32471@blorf.net> (raw)
In-Reply-To: <20060905183120.GA10848@cetus30.cs.utk.edu>

On Tue, Sep 05, 2006 at 02:31:20PM -0400, Chris Johnson wrote:
> Peter has some lines in the zsh Guide, section 2.5.10, about how zshenv
> is the cleanest place to set environment variables, PATH included.

It's my belief that you need to be careful to not force values in an
*env file that you might want to override.  For instance, if you ever
want to pass a custom PATH to a program, you can get bitten by this:

   PATH=/custom/bin program      #  works fine

   PATH=/custom/bin gdb program
   (gdb) r                       # might NOT work

The above discrepancy is because gdb uses $SHELL to spawn "program".
So, if one of the *env rc files sets PATH unconditionally, you can never
start a sub-shell with a custom PATH (or whatever other environment
variable gets set unconditionally).

I like to set environment variables in .zprofile, and then I also put
some kluge code in .zshenv that ensures that the file didn't get
skipped (which can happen if your login method didn't execute a login
shell, as is the case with some--but not all--X11 setups):

if [[ $SHLVL == 1 && ! -o LOGIN ]]; then
    source ~/.zprofile
fi

..wayne..


      parent reply	other threads:[~2006-09-06  6:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05 18:31 Chris Johnson
2006-09-05 21:08 ` William Scott
2006-09-06  4:01 ` Bart Schaefer
2006-09-06  6:16 ` Wayne Davison [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060906061657.GA32471@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=cjohnson@cs.utk.edu \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).