1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-26 10:03:40 +03:00

man: describe quoting and specifiers in Environment=

Fixes #10604.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-02-28 18:37:01 +01:00
parent 4d729e3796
commit e531091ba0

View File

@ -2263,18 +2263,24 @@ SystemCallErrorNumber=EPERM</programlisting>
<varlistentry>
<term><varname>Environment=</varname></term>
<listitem><para>Sets environment variables for executed processes. Takes a space-separated list of
variable assignments. This option may be specified more than once, in which case all listed variables
will be set. If the same variable is set twice, the later setting will override the earlier
setting. If the empty string is assigned to this option, the list of environment variables is reset,
all prior assignments have no effect. Variable expansion is not performed inside the strings,
however, specifier expansion is possible. The <literal>$</literal> character has no special
meaning. If you need to assign a value containing spaces or the equals sign to a variable, use double
quotes (") for the assignment.</para>
<listitem><para>Sets environment variables for executed processes. Each line is unquoted using the
rules described in "Quoting" section in
<citerefentry><refentrytitle>systemd.syntax</refentrytitle><manvolnum>5</manvolnum></citerefentry>
and becomes a list of variable assignments. If you need to assign a value containing spaces or the
equals sign to a variable, put quotes around the whole assignment. Variable expansion is not
performed inside the strings and the <literal>$</literal> character has no special meaning. Specifier
expansion is performed, see the "Specifiers" section in
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para>
<para>The names of the variables can contain ASCII letters, digits, and the underscore
character. Variable names cannot be empty or start with a digit. In variable values, most characters
are allowed, but non-printable characters are currently rejected.</para>
<para>This option may be specified more than once, in which case all listed variables will be set. If
the same variable is listed twice, the later setting will override the earlier setting. If the empty
string is assigned to this option, the list of environment variables is reset, all prior assignments
have no effect.</para>
<para>The names of the variables can contain ASCII letters, digits, and the underscore character.
Variable names cannot be empty or start with a digit. In variable values, most characters are
allowed, but non-printable characters are currently rejected.</para>
<para>Example:
<programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting>
@ -2284,10 +2290,9 @@ SystemCallErrorNumber=EPERM</programlisting>
<literal>word3</literal>, <literal>$word 5 6</literal>.
</para>
<para>
See <citerefentry
project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details
about environment variables.</para>
<para>See <citerefentry
project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
details about environment variables.</para>
<para>Note that environment variables are not suitable for passing secrets (such as passwords, key
material, …) to service processes. Environment variables set for a unit are exposed to unprivileged