Udev:使用结果进行比较

时间:2014-08-24 04:18:30

标签: linux udev

有人可以提示为什么会有效吗?

ACTION=="add", SUBSYSTEM=="block", PROGRAM="/bin/echo -n 12345", ENV{ID_FS_UUID}=="12345", RUN+="/path/to/some/script.sh %k %c $env{ID_FS_UUID}"

这不是吗?

ACTION=="add", SUBSYSTEM=="block", PROGRAM="/bin/echo -n 12345", ENV{ID_FS_UUID}=="%c", RUN+="/path/to/some/script.sh %k %c $env{ID_FS_UUID}"

1 个答案:

答案 0 :(得分:0)

您必须检查是否在指定$result的位置提供%c替换。来自 man udev

$result, %c
    The string returned by the external program requested with PROGRAM.
    A single part of the string, separated by a space character, may be
    selected by specifying the part number as an attribute: "%c{N}". If
    the number is followed by the "+" character, this part plus all
    remaining parts of the result string are substituted: "%c{N+}".

如果您没有提供正确的$result,那么就有问题。