[systemd-devel] user environment variables

Mantas Mikulėnas grawity at gmail.com
Fri Dec 5 07:36:33 PST 2014


On Fri, Dec 5, 2014 at 5:20 PM, Daniele Nicolodi <daniele at grinta.net> wrote:

> On 05/12/14 16:13, arnaud gaboury wrote:
> > Now:
> > ----------------------------------
> > $ echo 'lolo=4 lala=5' | tee test
> > lolo=4 lala=5
> > $ systemctl --user set-environment 'cat test'
> > Failed to set environment: Invalid environment assignments
> > -----------------------------------
> >
> > No idea what I do wrong.
>
> This is invalid shell syntax. This should work:
>
> $ systemctl --user set-environment `cat test`
>
> or, if you are using bash, I find this more readable:
>
> $ systemctl --user set-environment $(cat test)
>

As the variables sometimes have spaces, this might be more reliable:

    xargs systemctl --user set-environment < test

(With -d '\n' or without, depending on chosen syntax.)

It's possible to emulate "import-environment" using:

    xargs -d '\0' systemctl --user set-environment < /proc/self/environ

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20141205/204eb4a8/attachment.html>


More information about the systemd-devel mailing list