From c853953658865ec3b3487e3f1eb2cc0516320bf3 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 18 Dec 2014 18:08:13 -0500 Subject: load-fragment: allow quoting in command name and document allowed escapes The handling of the command name and other arguments is unified. This simplifies things and should make them more predictable for users. Incidentally, this makes ExecStart handling match the .desktop file specification, apart for the requirment for an absolute path. https://bugs.freedesktop.org/show_bug.cgi?id=86171 --- man/systemd.service.xml | 93 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 83 insertions(+), 10 deletions(-) (limited to 'man/systemd.service.xml') diff --git a/man/systemd.service.xml b/man/systemd.service.xml index da9079cbb8..0b68aa0890 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -377,11 +377,10 @@ For each of the specified commands, the first argument must be - an absolute and literal path to an - executable. Optionally, if the - absolute file name is prefixed with - @, the second token - will be passed as + an absolute path to an executable. + Optionally, if this file name is + prefixed with @, + the second token will be passed as argv[0] to the executed process, followed by the further arguments specified. If the @@ -1148,13 +1147,15 @@ Each command line is split on whitespace, with the first item being the command to execute, and the - subsequent items being the arguments. Double quotes + subsequent items being the arguments. Double quotes ("...") and single quotes ('...') may be used, in which case everything until the next matching quote - becomes part of the same argument. Quotes themselves - are removed after parsing. In addition, a trailing - backslash (\) may be used to merge - lines. + becomes part of the same argument. C-style escapes are + also supported, see table below. Quotes themselves are + removed after parsing and escape sequences + substituted. In addition, a trailing backslash + (\) may be used to merge lines. + This syntax is intended to be very similar to shell syntax, but only the meta-characters and @@ -1168,6 +1169,10 @@ other elements of shell syntax are not supported. + The command to execute must an absolute path + name. It may contain spaces, but control characters + are not allowed. + The command line accepts % specifiers as described in systemd.unit5. @@ -1253,6 +1258,74 @@ ExecStart=/bin/echo $ONE $TWO $THREE >/dev/null, &, ;, and /bin/ls. + + + C escapes supported in command lines and environment variables + + + + + + Literal + Actual value + + + + + \a + bell + + + \b + backspace + + + \f + form feed + + + \n + newline + + + \r + carriage return + + + \t + tab + + + \v + vertical tab + + + \\ + backslash + + + \" + double quotation mark + + + \' + single quotation mark + + + \s + space + + + \xxx + character number xx in hexadecimal encoding + + + \nnn + character number nnn in octal encoding + + + +
-- cgit v1.2.3-54-g00ecf