inz.fi

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 135dbb0888532bbb99a769797c5b941e34f819f6
parent 31f89ffcbe349bf68d75d8f24beabde06a4363c9
Author: Santtu Lakkala <inz@inz.fi>
Date:   Fri,  4 Mar 2011 11:03:11 +0000

Context aware bash environment

Diffstat:
Aposts/context-aware-bash-environment.md | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/posts/context-aware-bash-environment.md b/posts/context-aware-bash-environment.md @@ -0,0 +1,9 @@ +# Context aware bash environment + + While mixing hobby and work development on the same machine, I've every now and then longed for a way to set environment variables depending on the current directory. Up to now had I been too lazy to do anything about it, but finally did it. + + What the snippet does, it finds all current user owned .env files from current directory and it's parent directories, checks if the topmost has changed and if it has, reads them all in reverse order. If home directory was not a parent of current directory, the ~/.env is read before others. + + If you want this too, look at [the code](http://inz.fi/p/env.bash). Include these in your .bashrc, and you should be good to go. + +Examples of environment variables I've found useful are `DEB_EMAIL` and `DEB_FULLNAME` used by dpkg tools and the equivalents in git world, `GIT_COMMITTER_EMAIL`, `GIT_COMMITTER_NAME`.