[colug-432] zsh conditional env, specifically PATH var?

Rick Hornsby richardjhornsby at gmail.com
Mon Feb 18 11:31:05 EST 2019


Chefdk is necessary for work, but outside of that it’s getting in the way.
For example, right now I need to compile a python library, but it’s not
working because the Chefdk is in my $PATH and whatever binaries chefdk
ships with (m4 etc) are goofy.

I’m using ZSH, which I really like, mostly because of ohmyzsh. Obviously
the prompt (PS1) can be set conditionally (ie by the presence or absence of
a `.git/`), but can the environment vars be set/unset conditionally as
well? Specifically, I’d like to only have chefdk in $PATH when I’m cd’d
into my ‘cookbooks’ (literal) directory (and it’s children, which are the
actual cookbooks).

I don’t want to remove chefdk from $PATH entirely, and then have to
remember to put it back when I’m doing chef stuff.

Thanks!



* I’m on a Mac, but I don’t think that matters for this or ZSH in general.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20190218/444952c3/attachment.html 


More information about the colug-432 mailing list