我有一个挂载单元文件。 “Where”指令是“Where=/Data/mnt-wt”。 如何命名我的 .mount 单元文件?我读到“/”应该用短划线 (-) 代替。那破折号应该换成什么?
最佳答案
-
被替换为 \x2d
。使用 systemd-escape
为 systemd 转义字符串。
> systemd-escape Data/mnt-wt.mount
Data-mnt\x2dwt.mount
请注意,来自 https://www.freedesktop.org/software/systemd/man/systemd.mount.html#fstab如果您是人类,您可能更喜欢/etc/fstab:
Mount units may either be configured via unit files, or via /etc/fstab (see fstab(5) for details). Mounts listed in /etc/fstab will be converted into native units dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring mount points through /etc/fstab is the preferred approach to manage mounts for humans. For tooling, writing mount units should be preferred over editing /etc/fstab. See systemd-fstab-generator(8) for details about the conversion from /etc/fstab to mount units.
关于linux - 如何命名带有破折号的挂载单元文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53943112/