Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PSA: Mac OS X El Capitan upgrade might break your $PATH
- X-seq: zsh-users 20378
- From: Kurtis Rader <krader@xxxxxxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>
- Subject: Re: PSA: Mac OS X El Capitan upgrade might break your $PATH
- Date: Fri, 31 Jul 2015 15:10:30 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <CAHYJk3S-W_FYWEidfhC_g62=8B3hRLoyGnnOQsJcy4FPp9Ct5g@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABx2=D-TXjJpoN8pQOR6nswM4J3xxwgm8aoFn8ZyE-o2DZw9pQ@mail.gmail.com> <CAHYJk3S-W_FYWEidfhC_g62=8B3hRLoyGnnOQsJcy4FPp9Ct5g@mail.gmail.com>
On Fri, Jul 31, 2015 at 11:53 AM, Mikael Magnusson <mikachu@xxxxxxxxx>
wrote:
> That's good news, they used to have that code in /etc/zshenv which
> meant you had _no_ way to override it. It only took them a few years
> to fix this.
>
> As a sidenote, it's not a great idea to set your path in .zshenv, you
> should probably move those settings to your .zprofile. (Otherwise,
> running a script that uses zsh will not use the $PATH from the
> environment, which can break things in some situations).
>
It's a trade-off. Back when ksh93 was my primary shell I had a ~/.environ
file where I put such things. Then I sourced that from ~/.profile and my
crontab entries. That way my cron jobs would have an environment consistent
with my interactive shells. Zsh's .zshenv makes things much easier. It also
means that when I do something like
ssh home "some_command"
that command gets the same environment it would have if I had gotten an
interactive shell and run the command.
I protect against the problem you mention by checking if PATH contains
$HOME/bin. If it does I assume it's already been initialized to a
reasonable value and leave it alone. If not I install my own PATH.
Of course this is only a problem if you shadow commands -- something most
people don't do. In my case I have wrappers around things like ssh in my
~/bin directory that I want to have precedence over the system supplied
version.
--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
Messages sorted by:
Reverse Date,
Date,
Thread,
Author