bash: ./t.sh:/bin/bash^M: Damaged interpreter: No such file or directory

Sometimes an error similar to the title list will appear when writing scripts, this problem is because most of your script files edited in the windows.

Under windows, at the end of each line is \ n \ r, and at the end of the file under linux is \ n, then you are under the windows to see the edited file is opened in linux when the end of each line will be more out of character \ r,

With cat -A urfile you can see the \ r character is shown as ^ M, this time only you need to delete the character on it. You can use the command Sed -i 'S / \ R & lt // $' urfile .

Guess you like

Origin www.cnblogs.com/wangchaonan/p/11349962.html