Xubuntu LTS 16.0.4 无法识别 bash 脚本



我编写了一个 bash 脚本来使用 xinput 更改触摸板设置,但当我尝试运行脚本时,我收到一条消息,说该文件不存在。这是脚本:

#!/bin/bash
# change 'Synaptics Move Speed (278)' mouse speed
xinput set-prop 11 278 1, 15, .05, 40
# change and invert 'Synaptics Scrolling Distance (275)'
xinput set-prop 11 275 -90, -90
# enable 'Synaptics Locked Drags (280)'
xinput set-prop 11 280 1
# change 'Synaptics Locked Drags Timeout (281)'
xinput set-prop 11 281 600
# change 'device accel Constant Deceleration (263)'
xinput set-prop 11 263 3
#change 'Device Accel Adaptive Deceleration (264)'
xinput set-prop 11 264 2

该脚本称为 touchpad.sh,当我运行"sudo touchpad.sh"时,我收到错误消息:

sudo: touchpad.sh: command not found

我很困惑,因为我可以在命令行上单独运行这些命令中的每一个,所以我不确定出了什么问题。

shell 找不到您的脚本。

shell 在 PATH 环境变量中列出的文件夹中查找要执行的文件。当脚本不驻留在这些文件夹之一中时,需要指定文件的完整路径。

例如,如果脚本位于当前工作目录中,则可以使用

./touchpad.sh

最新更新