systemctl --user enable 'foo*'
从bash命令行运行成功;但是,将同一行放入 shell 脚本中并运行bash script
会产生结果
Invalid unit name "foo_*" was escaped as "foo_\x2a" (maybe you should use systemd-escape?)
Failed to enable unit: Unit file foo_\x2a.service does not exist.
注意我的systemctl
版本是239
.我见过这个问题的变体,但它们通常围绕 Windows 返回/回车问题(例子),而不是星号。