Fedora Account System
Red Hat Associate
Red Hat Customer
$ systemctl show -p Environment postgresql.service .. PG_OOM_ADJUST_VALUE=0 [unprintable] ... The "unprintable" variable is set by: Environment=PGDATA=/var/lib/pgsql/'da ta' Or by: Environment='PGDATA=/var/lib/pgsql/da ta' and there's actually nothing "unprintable" on that. It would be nice if systemctl could quote && print that variable, too.
Looks like upstream systemd uses escaping in this case. [root@notas ~]# systemctl show -p Environment cups.service Environment=PGDATA=/var/lib/pgsql/da\x20ta
Good, thanks - just for reference - could we link the upstream implementation (the escaping) from here? I'd like to ensure that something like this works: #! /bin/bash systemd_output=$(systemctl show -p Environment "$1") set -- ${systemd_output##Environment=} for item; do name=${item%%=*} value=$(echo -e "${item##*=}") eval "$name=\$value" done
I guess you want to call systemd-escape --unescape on the string.
Thanks, nice to know :-) but I guess I still need to split the environment variables, somehow.
Upstream used to do that, but it doesn't anymore :( https://github.com/systemd/systemd/commit/5993d46a1a
https://github.com/systemd/systemd/pull/15345
Built in rawhide.