man/systemd.service: add example for char prefixes

The prefixes can be specified for any part of the command. The docs imply this,
but it's not entirely obvious. Let's add an example.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2023-04-02 20:16:01 +02:00
parent 8202c01701
commit 4d7ae2557b

View file

@ -1249,7 +1249,7 @@
<tbody>
<row>
<entry><literal>@</literal></entry>
<entry>If the executable path is prefixed with <literal>@</literal>, the second specified token will be passed as <literal>argv[0]</literal> to the executed process (instead of the actual filename), followed by the further arguments specified.</entry>
<entry>If the executable path is prefixed with <literal>@</literal>, the second specified token will be passed as <constant>argv[0]</constant> to the executed process (instead of the actual filename), followed by the further arguments specified.</entry>
</row>
<row>
@ -1364,6 +1364,17 @@ ExecStart=/bin/echo $ONE $TWO $THREE</programlisting>
<para>Example:</para>
<programlisting>Type=oneshot
ExecStart=:echo $USER ; -false ; +:@true $TEST</programlisting>
<para>This will execute <command>/usr/bin/echo</command> with the literal argument
<literal>$USER</literal> (<literal>:</literal> suppresses variable expansion), and then
<command>/usr/bin/false</command> (the return value will be ignored because <literal>-</literal>
suppresses checking of the return value), and <command>/usr/bin/true</command> (with elevated privileges,
with <literal>$TEST</literal> as <constant>argv[0]</constant>).</para>
<para>Example:</para>
<programlisting>ExecStart=echo / &gt;/dev/null &amp; \; \
ls</programlisting>