From 5a914460007c47321165f9a0ca7c340e55f518c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 5 Mar 2020 07:33:06 +0000 Subject: [PATCH] Fix TMPDIR backup (#1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Co-authored-by: Jörg Thalheim --- direnvrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/direnvrc b/direnvrc index dc5c5cb..7f5764f 100644 --- a/direnvrc +++ b/direnvrc @@ -43,15 +43,15 @@ 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 log_status eval "$cache" 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 + export PATH=$PATH:$path_backup TERM=$term_backup + if [[ ! -z ${tmp_backup+x} ]]; then export TMPDIR=${tmp_backup} else unset TMPDIR