我想用一个脚本在启动过程中禁用我的触摸板这样从命令响应中提取数据,并将其存储在一个变量
#!/bin/bash
# determine device id
ID=$(xinput list | grep -i touchpad)
# check output
echo $ID
# disable device identified by $ID
#xinput set-prop $ID "Device Enabled" 0</code>
Basically I would like to extract "12" (or whatever number the device has) from the result of command:
- xinput list | grep -i touchpad
⎜ ↳ SynPS/2 Synaptics TouchPad id=12 [slave pointer (2)]
and store it in variable $ID.
The next command would disable the device.
Any suggestions on how I can achieve that?
Thanks, Udo
XINPUT名单| awk -F'[=]''/ TouchPad/{print $ 5}'输出SynPS/2 - >更改参数不会给我12 ...第二个命令在小编辑后工作;) – udo 2011-02-05 19:51:12
@udo我拒绝你的编辑,但同时有人批准它。最好使用最终使用的代码编辑您的问题,而不是修改/编辑答案。 – 2011-02-05 19:58:44