305 lines
6.2 KiB
HTML
305 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SYSTEMD-ESCAPE</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SYSTEMD-ESCAPE</H1>
|
|
Section: systemd-escape (1)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
systemd-escape - Escape strings for usage in systemd unit names
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>systemd-escape</B> [OPTIONS...] [STRING...]
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>systemd-escape</B>
|
|
<DD>may be used to escape strings for inclusion in systemd unit names. The command may be used to escape and to undo escaping of strings.
|
|
<P>
|
|
|
|
The command takes any number of strings on the command line, and will process them individually, one after another. It will output them separated by spaces to stdout.
|
|
<P>
|
|
|
|
By default, this command will escape the strings passed, unless
|
|
<B>--unescape</B>
|
|
is passed which results in the inverse operation being applied. If
|
|
<B>--mangle</B>
|
|
is given, a special mode of escaping is applied instead, which assumes the string is already escaped but will escape everything that appears obviously non-escaped.
|
|
<P>
|
|
|
|
For details on the escaping and unescaping algorithms see the relevant section in
|
|
<B><A HREF="/cgi-bin/man/man2html?5+systemd.unit">systemd.unit</A></B>(5).
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<P>
|
|
|
|
The following options are understood:
|
|
<P>
|
|
|
|
<B>--suffix=</B>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
Appends the specified unit type suffix to the escaped string. Takes one of the unit types supported by systemd, such as
|
|
"service"
|
|
or
|
|
"mount". May not be used in conjunction with
|
|
<B>--template=</B>,
|
|
<B>--unescape</B>
|
|
or
|
|
<B>--mangle</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--template=</B>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
Inserts the escaped strings in a unit name template. Takes a unit name template such as
|
|
<A HREF="mailto:foobar@.service">foobar@.service</A>. With
|
|
<B>--unescape</B>, expects instantiated unit names for this template and extracts and unescapes just the instance part. May not be used in conjunction with
|
|
<B>--suffix=</B>,
|
|
<B>--instance</B>
|
|
or
|
|
<B>--mangle</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--path</B>, <B>-p</B>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
When escaping or unescaping a string, assume it refers to a file system path. This eliminates leading, trailing or duplicate
|
|
"/"
|
|
characters and rejects
|
|
"."
|
|
and
|
|
".."
|
|
path components. This is particularly useful for generating strings suitable for unescaping with the
|
|
"%f"
|
|
specifier in unit files, see
|
|
<B><A HREF="/cgi-bin/man/man2html?5+systemd.unit">systemd.unit</A></B>(5).
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--unescape</B>, <B>-u</B>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
Instead of escaping the specified strings, undo the escaping, reversing the operation. May not be used in conjunction with
|
|
<B>--suffix=</B>
|
|
or
|
|
<B>--mangle</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--mangle</B>, <B>-m</B>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
Like
|
|
<B>--escape</B>, but only escape characters that are obviously not escaped yet, and possibly automatically append an appropriate unit type suffix to the string. May not be used in conjunction with
|
|
<B>--suffix=</B>,
|
|
<B>--template=</B>
|
|
or
|
|
<B>--unescape</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--instance</B>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
With
|
|
<B>--unescape</B>, unescape and print only the instance part of an instantiated unit name template. Results in an error for an uninstantiated template like
|
|
<A HREF="mailto:ssh@.service">ssh@.service</A>
|
|
or a non-template name like
|
|
ssh.service. Must be used in conjunction with
|
|
<B>--unescape</B>
|
|
and may not be used in conjunction with
|
|
<B>--template</B>.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>-h</B>, <B>--help</B>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
Print a short help text and exit.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<B>--version</B>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
Print a short version string and exit.
|
|
</DL>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
|
|
To escape a single string:
|
|
<P>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape 'Hallöchen, Meister'
|
|
Hall\xc3\xb6chen\x2c\x20Meister
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
To undo escaping on a single string:
|
|
<P>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape -u 'Hall\xc3\xb6chen\x2c\x20Meister'
|
|
Hallöchen, Meister
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
To generate the mount unit for a path:
|
|
<P>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape -p --suffix=mount "/tmp//waldi/foobar/"
|
|
tmp-waldi-foobar.mount
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
To generate instance names of three strings:
|
|
<P>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape --template=<A HREF="mailto:systemd-nspawn@.service">systemd-nspawn@.service</A> 'My Container 1' 'containerb' 'container/III'
|
|
systemd-nspawn@My\x20Container\x201.service <A HREF="mailto:systemd-nspawn@containerb.service">systemd-nspawn@containerb.service</A> <A HREF="mailto:systemd-nspawn@container-III.service">systemd-nspawn@container-III.service</A>
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
To extract the instance part of an instantiated unit:
|
|
<P>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape -u --instance 'systemd-nspawn@My\x20Container\x201.service'
|
|
My Container 1
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<P>
|
|
|
|
To extract the instance part of an instance of a particular template:
|
|
<P>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
|
|
|
|
|
|
<PRE>
|
|
$ systemd-escape -u --template=<A HREF="mailto:systemd-nspawn@.service">systemd-nspawn@.service</A> 'systemd-nspawn@My\x20Container\x201.service'
|
|
My Container 1
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXIT STATUS</H2>
|
|
|
|
<P>
|
|
|
|
On success, 0 is returned, a non-zero failure code otherwise.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
<B><A HREF="/cgi-bin/man/man2html?5+systemd.unit">systemd.unit</A></B>(5),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemctl">systemctl</A></B>(1)
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="16"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="17"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="18"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="19"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="20"><A HREF="#lbAF">EXAMPLES</A><DD>
|
|
<DT id="21"><A HREF="#lbAG">EXIT STATUS</A><DD>
|
|
<DT id="22"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:28 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|