Last active
April 2, 2019 08:36
-
-
Save adamluzsi/f5ef4d02d0bd0ca399508a5453ba4472 to your computer and use it in GitHub Desktop.
direnv direnvrc file to source all .envrc file
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
#!/bin/sh | |
source_up_all() { | |
local originalPWD=$(pwd) | |
local currentPWD=${originalPWD} | |
while [ "${currentPWD}" != "/" ]; do | |
cd .. | |
currentPWD=$(pwd) | |
local envrcPath="${currentPWD}/.envrc" | |
if [ -f "${envrcPath}" ]; then | |
source_env "${envrcPath}" | |
fi | |
done | |
cd "${originalPWD}" | |
} | |
source_up_all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is unsafe, and I don't suggest using it on a system you don't trust.