Fix the env variable to set when it does not exist

This commit is contained in:
Maxime Hélias 2018-01-19 22:58:28 +01:00 committed by Maxime Helias
parent 0cec462621
commit ce0266831f

View File

@ -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
}