bash-newbie here.
I want to use the following simple script as a shortcut to enable/disable the touchpad of my laptop:
#!/bin/bash
result=$(xinput --list-props 11 | grep "Device Enabled")
echo $result
# Output: Device Enabled (140): 1
if [[ "$result" = "Device Enabled (140): 1" ]]; then
`xinput set-prop 11 "Device Enabled" 0`
else
`xinput set-prop 11 "Device Enabled" 1`
fi
The if-condition is however never entered. echo $result
shows that the variable really contains the string-value that I want to compare. I have been searching for a while but can not at all figure out why the result-variable and the string do not match in the if-condition.