sudo: unable to execute ./script.sh: no such file or directory

I just had this exact problem, it turned out to be a text file encoding problem. For me to fix it while running Xubuntu 14.04.3 LTS, I installed dos2unix and converted the script's encoding and then ran the script again using sudo and it worked fine. You can find an example below:

sudo apt-get install dos2unix -y
dos2unix test.sh
sudo chmod u+x test.sh && sudo ./test.sh

参考:http://unix.stackexchange.com/questions/144718/sudo-unable-to-execute-script-sh-no-such-file-or-directory

posted on 2016-01-30 03:52  今天又进步了  阅读(1633)  评论(0编辑  收藏  举报

导航