Skip to content

Instantly share code, notes, and snippets.

@adamluzsi
Last active April 2, 2019 08:36
Show Gist options
  • Save adamluzsi/f5ef4d02d0bd0ca399508a5453ba4472 to your computer and use it in GitHub Desktop.
Save adamluzsi/f5ef4d02d0bd0ca399508a5453ba4472 to your computer and use it in GitHub Desktop.
direnv direnvrc file to source all .envrc file
#!/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
@adamluzsi
Copy link
Author

This is unsafe, and I don't suggest using it on a system you don't trust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment