所以我需要运行一个脚本,然后我只需将其拖放到控制台,但控制台输出此错误:
matas@H81M-D2V:~/Desktop/gui$ '/home/matas/Desktop/gui/load.sh'
bash: /home/matas/Desktop/gui/load.sh: /bin/bash^M: bad interpreter: No such file or directory
matas@H81M-D2V:~/Desktop/gui$ ^C
matas@H81M-D2V:~/Desktop/gui$ ^C
matas@H81M-D2V:~/Desktop/gui$
剧本:
#!/bin/bash
if [[ $(nvidia-settings -q '[gpu:0]/DigitalVibrance[DFP-1]' | grep 'Attribute.*1023\.') ]]
then
nvidia-settings -a '[gpu:0]/DigitalVibrance[DFP-1]=0' > /dev/null
echo "Vibrance Disabled"
else
nvidia-settings -a '[gpu:0]/DigitalVibrance[DFP-1]=1023' > /dev/null
echo "Vibrance Enabled"
fi
答案1
您的换行符不受支持,可能是 Windows 文本编辑器不支持。解决此问题的最简单方法是安装dos2unix
并转换文件:
apt-get install dos2unix
dos2unix -n load.sh newload.sh