1SYSTEMD-ESCAPE(1)               systemd-escape               SYSTEMD-ESCAPE(1)
2
3
4

NAME

6       systemd-escape - Escape strings for usage in systemd unit names
7

SYNOPSIS

9       systemd-escape [OPTIONS...] [STRING...]
10

DESCRIPTION

12       systemd-escape may be used to escape strings for inclusion in systemd
13       unit names. The command may be used to escape and to undo escaping of
14       strings.
15
16       The command takes any number of strings on the command line, and will
17       process them individually, one after another. It will output them
18       separated by spaces to stdout.
19
20       By default, this command will escape the strings passed, unless
21       --unescape is passed which results in the inverse operation being
22       applied. If --mangle is given, a special mode of escaping is applied
23       instead, which assumes the string is already escaped but will escape
24       everything that appears obviously non-escaped.
25
26       For details on the escaping and unescaping algorithms see the relevant
27       section in systemd.unit(5).
28

OPTIONS

30       The following options are understood:
31
32       --suffix=
33           Appends the specified unit type suffix to the escaped string. Takes
34           one of the unit types supported by systemd, such as "service" or
35           "mount". May not be used in conjunction with --template=,
36           --unescape or --mangle.
37
38       --template=
39           Inserts the escaped strings in a unit name template. Takes a unit
40           name template such as foobar@.service. May not be used in
41           conjunction with --suffix=, --unescape or --mangle.
42
43       --path, -p
44           When escaping or unescaping a string, assume it refers to a file
45           system path. This eliminates leading, trailing or duplicate "/"
46           characters and rejects "."  and ".."  path components. This is
47           particularly useful for generating strings suitable for unescaping
48           with the "%f" specifier in unit files, see systemd.unit(5).
49
50       --unescape, -u
51           Instead of escaping the specified strings, undo the escaping,
52           reversing the operation. May not be used in conjunction with
53           --suffix=, --template= or --mangle.
54
55       --mangle, -m
56           Like --escape, but only escape characters that are obviously not
57           escaped yet, and possibly automatically append an appropriate unit
58           type suffix to the string. May not be used in conjunction with
59           --suffix=, --template= or --unescape.
60
61       -h, --help
62           Print a short help text and exit.
63
64       --version
65           Print a short version string and exit.
66

EXAMPLES

68       To escape a single string:
69
70           $ systemd-escape 'Hallöchen, Meister'
71           Hall\xc3\xb6chen\x2c\x20Meister
72
73       To undo escaping on a single string:
74
75           $ systemd-escape -u 'Hall\xc3\xb6chen\x2c\x20Meister'
76           Hallöchen, Meister
77
78       To generate the mount unit for a path:
79
80           $ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/"
81           tmp-waldi-foobar.mount
82
83       To generate instance names of three strings:
84
85           $ systemd-escape --template=systemd-nspawn@.service 'My Container 1' 'containerb' 'container/III'
86           systemd-nspawn@My\x20Container\x201.service systemd-nspawn@containerb.service systemd-nspawn@container-III.service
87

EXIT STATUS

89       On success, 0 is returned, a non-zero failure code otherwise.
90

SEE ALSO

92       systemd(1), systemd.unit(5), systemctl(1)
93
94
95
96systemd 239                                                  SYSTEMD-ESCAPE(1)
Impressum