How to fix below error?
[root@server /]# ./script test bash: ./script: /bin/bash^M: bad interpreter: No such file or directory
There nultiple way to fix this error, the problem is with the file format, you need to convert it to Unix format and your error should be gone.
You can fire the command below to fix.
[root@server /]# dos2unix filename
You can try steps below
Open file, vi script then press ESC and enter :set fileformat=unix save file and try to run script again.