fix: environment variables with spaces

This commit is contained in:
Thomas Wouters 2026-02-03 16:37:32 +01:00 committed by GitHub
parent 77a284009c
commit 7b5fd4de9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -67,7 +67,7 @@ if command -v systemctl >/dev/null; then
# For environment variables already imported into the user's
# session, if the value imported differs from the value in this
# environment, update it.
existing_env_vars=( $(systemctl --user show-environment | tr '\n' ' ') )
mapfile -t existing_env_vars < <(systemctl --user show-environment)
for env_var in "${existing_env_vars[@]}"; do
env_var_name="$(echo "${env_var}" | awk -F '=' '{print $1}')"
env_var_val_str_to_compare="${env_var_name}=${!env_var_name:-}"