From ce0266831fc039433f9568a2e725b131253dc583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Fri, 19 Jan 2018 22:58:28 +0100 Subject: [PATCH] Fix the env variable to set when it does not exist --- lib/functions.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/functions.zsh b/lib/functions.zsh index f3065378..67a776d9 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -95,8 +95,8 @@ function default() { # 0 if the env variable exists, 3 if it was set # function env_default() { - env | grep -q "^$1=" && return 0 - export "$1=$2" && return 3 + [[ -z "$1" && ${env | grep -q "^$1="} ]] && return 0 + export "$1=$2" && return 3 }