[systemd-devel] Environment or an environment file with empty variable value

Andrey Borzenkov arvidjaar at gmail.com
Wed Sep 18 21:08:21 PDT 2013


В Wed, 18 Sep 2013 15:51:27 -0500
David Strauss <david at davidstrauss.net> пишет:

> On Wed, Sep 18, 2013 at 7:25 AM, Belal, Awais <Awais_Belal at mentor.com> wrote:
> > Is this the intended behavior?
> 
> Yes: "If the empty string is assigned to this option, the list of
> environment variables is reset, all prior assignments have no effect."
> [1]
> 

This quote is about valued of Environment *option* itself while the
question was about value of environment *variable*. It is indeed
impossible to pass empty variable:

bor at opensuse:~> cat /run/systemd/system/testenv.service 
[Unit]
Description=Test environments

[Service]
Type=oneshot
Environment=FOO=
ExecStart=/bin/sh -c 'echo FOO is $${FOO+set}$${FOO-unset}'
bor at opensuse:~> sudo journalctl _SYSTEMD_UNIT=testenv.service
-- Logs begin at Sun, 2012-09-09 00:46:39 MSK, end at Thu, 2013-09-19 08:07:02 M
Sep 19 08:05:15 opensuse.site sh[4845]: FOO is unset

> [1] http://www.freedesktop.org/software/systemd/man/systemd.exec.html
> 



More information about the systemd-devel mailing list