unable to execute ./start.sh: No such file or directory

Just wrote a shell file sudden encounter when performing shell file does not run, all of a sudden feel odd strange, clearly written shell file, and add executable permissions, even suggesting this result: as follows

 

[testuser@ISER-2812 opt]$ sudo ./my.sh sudo: unable to execute ./my.sh: No such file or directory

     Try vim file to open the sh file, enter : the SET FF , show fileformat = unix, explained there is no problem (if the display fileformat = dos, then there is a problem, use the command : set ff = unix re-set at the file format and then save and exit ). But after several attempts or suggest such a phenomenon, and finally I opened the shell file, delete the first few rows in the file, in particular the first sentence of that line of code specifies the command interpreter. They are deleted and then write stored in the vi command. The next time you perform a success.

 

    So think of the problem, my shell file my copy and then paste in the linux VI in from the windows in Notepad, and save the windows notepad format is ANSI, the head this time when pasted into a file in linux may be garbage characters cause the shell under linux does not recognize sh file. I do not have to try, if you save into Notepad, then copy and paste utf8 format will not be faced with this problem.

Guess you like

Origin www.cnblogs.com/hmy-1365/p/12123602.html