我想用一個腳本在啓動過程中禁用我的觸摸板這樣從命令響應中提取數據,並將其存儲在一個變量
#!/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