From 42752142e37320a99f37e7a96c9976886a822a39 Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Wed, 28 Jan 2026 11:04:50 +0100 Subject: [PATCH] Use mapfile to read environment variables Looping `tr '\n' ' '` would break if variables contain whitespace --- data/start-cosmic | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/start-cosmic b/data/start-cosmic index 7414646..6e05738 100755 --- a/data/start-cosmic +++ b/data/start-cosmic @@ -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:-}"