'\" t .TH "SYSTEMD\-ESCAPE" "1" "" "systemd 231" "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 \- 转义与还原单元名称中的特殊字符 .SH "SYNOPSIS" .HP \w'\fBsystemd\-escape\fR\ 'u \fBsystemd\-escape\fR [OPTIONS...] [STRING...] .SH "描述" .PP \fBsystemd\-escape\fR 可用于 转义单元名称中的特殊字符, 也可用于还原操作。 .PP 可以在命令行上指定任意数量的字符串, 表示依次分别处理它们。 处理结果将使用空格分隔。 .PP 默认的行为是转义操作, 但若使用了 \fB\-\-unescape\fR 选项, 则表示反向的还原操作。如果使用了 \fB\-\-mangle\fR 选项, 则会使用一种特殊的转义规则, 也就是假定字符串已经经过了转义, 仅转义那些显而易见必须转义的字符。 .SH "选项" .PP 能够识别的命令行选项如下: .PP \fB\-\-suffix=\fR .RS 4 在输出结果尾部添加一个单元类型后缀。 必须是 "\&.service" 或 "\&.mount" 这样实际有效的后缀。不能与 \fB\-\-template=\fR, \fB\-\-unescape\fR , \fB\-\-mangle\fR 选项一起使用。 .RE .PP \fB\-\-template=\fR .RS 4 将转义之后的结果插入一个单元名称模版。 接收一个类似 foobar@\&.service 这样的模版名。 不能与 \fB\-\-suffix=\fR, \fB\-\-unescape\fR, \fB\-\-mangle\fR 选项一起使用。 .RE .PP \fB\-\-path\fR, \fB\-p\fR .RS 4 在转义或还原字符串时, 假定其是一个文件系统路径。 这将会对字符串头的 "/" 字符进行特殊处理。 .RE .PP \fB\-\-unescape\fR .RS 4 将已经转义过的字符串还原。 不能与 \fB\-\-suffix=\fR, \fB\-\-template=\fR, \fB\-\-mangle\fR 选项一起使用。 .RE .PP \fB\-\-mangle\fR .RS 4 与 \fB\-\-escape\fR 类似, 但是仅转义那些显而易见必须转义的字符, 并且允许自动添加适当的单元类型后缀。 不能与 \fB\-\-suffix=\fR, \fB\-\-template=\fR, \fB\-\-unescape\fR 选项一起使用。 .RE .PP \fB\-h\fR, \fB\-\-help\fR .RS 4 显示简短的帮助信息并退出。 .RE .PP \fB\-\-version\fR .RS 4 显示简短的版本信息并退出。 .RE .SH "例子" .PP 转义一个字符串 .sp .if n \{\ .RS 4 .\} .nf $ systemd\-escape \*(AqHallöchen, Meister\*(Aq Hall\exc3\exb6chen\ex2c\ex20Meister .fi .if n \{\ .RE .\} .PP 还原一个字符串 .sp .if n \{\ .RS 4 .\} .nf $ systemd\-escape \-u \*(AqHall\exc3\exb6chen\ex2c\ex20Meister\*(Aq Hallöchen, Meister .fi .if n \{\ .RE .\} .PP 为一个路径生成对应的单元名 .sp .if n \{\ .RS 4 .\} .nf $ systemd\-escape \-p \-\-suffix=mount "/tmp//waldi/foobar/" tmp\-waldi\-foobar\&.mount .fi .if n \{\ .RE .\} .PP 从三个字符串派生三个对应的实例单元名 .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 "退出状态" .PP 返回值为 0 表示成功, 非零返回值表示失败代码。 .SH "参见" .PP \fBsystemd\fR(1), \fBsystemctl\fR(1) .SH "跋" .br 本页面中文版由中文 man 手册页计划提供。 .PP 翻译人员:金步国 .br 金步国作品集:http://www.jinbuguo.com .br .br 中文 man 手册页计划:\fBhttps://github.com/man-pages-zh/manpages-zh\fR