Created
February 10, 2012 12:52
-
-
Save casualjim/1789516 to your computer and use it in GitHub Desktop.
Source a file in a directory hierarchy if found in zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chpwd() { | |
moj_root=$(pwd -P 2>/dev/null || command pwd) | |
while [ ! -e "$moj_root/.mojolly-env" ]; do | |
moj_root=${moj_root%/*} | |
if [ "$moj_root" = "" ]; then break; fi | |
done | |
if [ -r "$moj_root/.mojolly-env" ]; then source "$moj_root/mojolly-env"; fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment