今天做nginx日志切割,发现一个错误:
#-bash: ./cut_nginx_logs.sh: /bin/bash^M: bad interpreter: 没有那个文件或目录
#vi cut_nginx_logs.sh
:set ff 回车
fileformat=dos
:set fileformat=unix
然后执行脚本就正常了,原来是因为我这个文件在windows下编辑过,所以格式不对,将格式设置为unix格式就可以了。
转载于:https://blog.51cto.com/dnuser/1265403