Xubuntu LTS 16.0.4无法识别bash脚本[重复]

问题描述 投票:-1回答:1

这个问题在这里已有答案:

我写了一个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

我很困惑,因为我可以在命令行上单独运行这些命令,所以我不确定是什么错。

linux bash ubuntu s
1个回答
1
投票

shell无法找到您的脚本。

shell查找要在PATH环境变量中列出的文件夹中执行的文件。当您的脚本不在其中一个文件夹中时,您需要指定该文件的完整路径。

例如,如果脚本位于当前工作目录中,则您将其调用

./touchpad.sh

© www.soinside.com 2019 - 2024. All rights reserved.