执行一个shell脚本的时候报错:
$ /home/oracle/task/db.sh
-bash: /home/oracle/task/db.sh: /bin/bash^M: bad interpreter: No such file or directory
好像在末尾多了个^M的符号。
好像是windows格式的,就是dos格式的
看看文件编码:
vi这个文件,输入:set ff?
发现返回:fileformat=dos
证明是dos格式的,下面把这个脚本转换成unix格式:
方法一:用vi的:set ff=unix
方法二:用dos2unix命令
然后脚本正常。