feat: Don't add empty or already-set variables

This commit is contained in:
Nick Novitski 2023-10-18 22:09:38 -07:00
parent 645aeb5651
commit a30a7fa1b3

View file

@ -18,6 +18,11 @@ while IFS='=' read -r -d '' n v; do
if [ "$n" == "PATH" ]; then if [ "$n" == "PATH" ]; then
continue continue
fi fi
# Skip if the variable is already in the environment with the same
# value (treating unset and the empty string as identical states)
if [ "${!n:-}" == "$v" ]; then
continue
fi
if (("$(wc -l <<<"$v")" > 1)); then if (("$(wc -l <<<"$v")" > 1)); then
delimiter=$(openssl rand -base64 18) delimiter=$(openssl rand -base64 18)
if contains "$delimiter" "$v"; then if contains "$delimiter" "$v"; then