Ignore variables used by direnv

All variables matching DIRENV_* are excluded to not influence direnv behavior.
master
0xee 2019-11-27 15:05:32 +01:00
parent ac83f17b77
commit f6fc817e84
1 changed files with 13 additions and 9 deletions

View File

@ -32,13 +32,16 @@ diffEnvs() {
while IFS= read -r -d '' line; do
name=$(tr -d '\0' <<<"$line" | head -n1 | cut -f1 -d'=')
if ! [[ "$name" = DIRENV_* ]]; then
if ! getByName "$name" "$new" >/dev/null; then
echo "export -n '${name}'"
fi
fi
done <"$old"
while IFS= read -rd $'\0' line; do
name=$(tr -d '\0' <<<"$line" | head -n1 | cut -f1 -d'=')
if ! [[ "$name" = DIRENV_* ]]; then
if getByName "$name" "$old" >/dev/null; then
# found in old env, check if values match
if ! grep -z "^${line}\$" "$old" >/dev/null; then
@ -49,6 +52,7 @@ diffEnvs() {
# variable is new
echo "export ${line@Q}"
fi
fi
done <"$new"
}