From ac5dcea4781b0033c1a1e2cd5df77fb66cd20f99 Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Wed, 4 Mar 2020 22:13:58 -0500 Subject: [PATCH] Fix TMPDIR backup This was clearing TMPDIR since it was first not setting the `tmp_backup` local variable, and then, since `tmp_backup` was null, it was unsetting TMPDIR. --- direnvrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/direnvrc b/direnvrc index dc5c5cb..3e2973a 100644 --- a/direnvrc +++ b/direnvrc @@ -43,7 +43,7 @@ use_nix() { log_status using cached derivation fi local term_backup=$TERM path_backup=$PATH - if [[ -z ${TMPDIR+x} ]]; then + if [[ ! -z ${TMPDIR+x} ]]; then local tmp_backup=$TMPDIR fi @@ -51,7 +51,7 @@ use_nix() { read -r cache_content < "$cache" eval "$cache_content" export PATH=$PATH:$path_backup TERM=$term_backup TMPDIR=$tmp_backup - if [ -z ${tmp_backup+x} ]; then + if [ ! -z ${tmp_backup+x} ]; then export TMPDIR=${tmp_backup} else unset TMPDIR