Simplify environment variable check
This commit is contained in:
parent
1f67aaa43b
commit
c490764c7e
7
setup.sh
7
setup.sh
@ -67,11 +67,12 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
root=true
|
root=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Checks to see if variable is set and non-empty.
|
||||||
env_var_exists() {
|
env_var_exists() {
|
||||||
local env_var=
|
if [[ ! -v "$1" ]] || [[ -z "$1" ]]; then
|
||||||
env_var=$(declare -p "$1")
|
|
||||||
if ! [[ -v $1 && $env_var =~ ^declare\ -x ]]; then
|
|
||||||
return 1
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user