mirror of
https://git.proxmox.com/git/systemd
synced 2025-06-02 04:31:01 +00:00
161 lines
4.2 KiB
Groff
161 lines
4.2 KiB
Groff
'\" t
|
|
.TH "SYSTEMD\-ESCAPE" "1" "" "systemd 219" "systemd-escape"
|
|
.\" -----------------------------------------------------------------
|
|
.\" * Define some portability stuff
|
|
.\" -----------------------------------------------------------------
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.\" http://bugs.debian.org/507673
|
|
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
|
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\" -----------------------------------------------------------------
|
|
.\" * set default formatting
|
|
.\" -----------------------------------------------------------------
|
|
.\" disable hyphenation
|
|
.nh
|
|
.\" disable justification (adjust text to left margin only)
|
|
.ad l
|
|
.\" -----------------------------------------------------------------
|
|
.\" * MAIN CONTENT STARTS HERE *
|
|
.\" -----------------------------------------------------------------
|
|
.SH "NAME"
|
|
systemd-escape \- Escape strings for usage in system unit names
|
|
.SH "SYNOPSIS"
|
|
.HP \w'\fBsystemd\-escape\fR\ 'u
|
|
\fBsystemd\-escape\fR [OPTIONS...] [STRING...]
|
|
.SH "DESCRIPTION"
|
|
.PP
|
|
\fBsystemd\-escape\fR
|
|
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\&.
|
|
.PP
|
|
The command takes any number of strings on the command line, and will process them individually, one after the other\&. It will output them separated by spaces to stdout\&.
|
|
.PP
|
|
By default this command will escape the strings passed, unless
|
|
\fB\-\-unescape\fR
|
|
is passed which results in the inverse operation being applied\&. If
|
|
\fB\-\-mangle\fR
|
|
a special mode of escaping is applied instead, which assumes a string to be already escaped but will escape everything that appears obviously non\-escaped\&.
|
|
.SH "OPTIONS"
|
|
.PP
|
|
The following options are understood:
|
|
.PP
|
|
\fB\-\-suffix=\fR
|
|
.RS 4
|
|
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
|
|
\fB\-\-template=\fR,
|
|
\fB\-\-unescape\fR
|
|
or
|
|
\fB\-\-mangle\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-\-template=\fR
|
|
.RS 4
|
|
Inserts the escaped strings in a unit name template\&. Takes a unit name template such as
|
|
foobar@\&.service
|
|
May not be used in conjunction with
|
|
\fB\-\-suffix=\fR,
|
|
\fB\-\-unescape\fR
|
|
or
|
|
\fB\-\-mangle\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-\-path\fR, \fB\-p\fR
|
|
.RS 4
|
|
When escaping or unescaping a string, assume it refers to a file system path\&. This enables special processing of the initial
|
|
"/"
|
|
of the path\&.
|
|
.RE
|
|
.PP
|
|
\fB\-\-unescape\fR
|
|
.RS 4
|
|
Instead of escaping the specified strings, undo the escaping, reversing the operation\&. May not be used in conjunction with
|
|
\fB\-\-suffix=\fR,
|
|
\fB\-\-template=\fR
|
|
or
|
|
\fB\-\-mangle\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-\-mangle\fR
|
|
.RS 4
|
|
Like
|
|
\fB\-\-escape\fR, 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
|
|
\fB\-\-suffix=\fR,
|
|
\fB\-\-template=\fR
|
|
or
|
|
\fB\-\-unescape\fR\&.
|
|
.RE
|
|
.PP
|
|
\fB\-h\fR, \fB\-\-help\fR
|
|
.RS 4
|
|
Print a short help text and exit\&.
|
|
.RE
|
|
.PP
|
|
\fB\-\-version\fR
|
|
.RS 4
|
|
Print a short version string and exit\&.
|
|
.RE
|
|
.SH "EXAMPLES"
|
|
.PP
|
|
Escape a single string:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
$ systemd\-escape \*(AqHallöchen, Meister\*(Aq
|
|
Hall\exc3\exb6chen\ex2c\ex20Meister
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.PP
|
|
To undo escaping on a single string:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
$ systemd\-escape \-u \*(AqHall\exc3\exb6chen\ex2c\ex20Meister\*(Aq
|
|
Hallöchen, Meister
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.PP
|
|
To generate the mount unit for a path:
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
$ systemd\-escape \-p \-\-suffix=mount "/tmp//waldi/foobar/"
|
|
tmp\-waldi\-foobar\&.mount
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.PP
|
|
To generate instance names of three strings
|
|
.sp
|
|
.if n \{\
|
|
.RS 4
|
|
.\}
|
|
.nf
|
|
$ systemd\-escape \-\-template=systemd\-nspawn@\&.service \*(AqMy Container 1\*(Aq \*(Aqcontainerb\*(Aq \*(Aqcontainer/III\*(Aq
|
|
systemd\-nspawn@My\ex20Container\ex201\&.service systemd\-nspawn@containerb\&.service systemd\-nspawn@container\-III\&.service
|
|
.fi
|
|
.if n \{\
|
|
.RE
|
|
.\}
|
|
.SH "EXIT STATUS"
|
|
.PP
|
|
On success, 0 is returned, a non\-zero failure code otherwise\&.
|
|
.SH "SEE ALSO"
|
|
.PP
|
|
\fBsystemd\fR(1),
|
|
\fBsystemctl\fR(1)
|