【问题标题】:How do I set a dbus property to a negative value with busctl?如何使用 busctl 将 dbus 属性设置为负值?
【发布时间】:2021-02-03 15:00:16
【问题描述】:

我正在尝试使用busctldouble 类型的属性设置为负值。正值很好:

busctl set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d 1.0

但尝试将其更改为负值会出现以下错误:

busctl set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d -1.0
busctl: invalid option -- '1'

我尝试了一些显而易见的方法,例如将-1.0 放在单引号、双引号中或使用反斜杠转义-。有一个-- 选项,但这似乎没有任何效果。

【问题讨论】:

    标签: linux systemd dbus


    【解决方案1】:

    busctl -- set-property com.acme.foo /com/acme/foo com.acme.foo.Interface inflation d -1.0

    -- 选项告诉 busctl -- 之后的所有内容都不是选项。像许多 unix 工具一样,busctl 使用 optarg 进行命令行解析。有关这方面的更多信息,请参阅man optarg

    【讨论】:

    • 正确。谢谢!
    猜你喜欢
    • 2018-07-16
    • 2016-05-07
    • 1970-01-01
    • 1970-01-01
    • 2017-10-12
    • 1970-01-01
    • 1970-01-01
    • 2012-01-22
    • 1970-01-01
    相关资源
    最近更新 更多