Linux 换行为 \ n,Windows 换行为 \ r\n,Windows 环境编辑的 shell 脚本在 Linux 下执行会报错:
line 2: $'\r': command not found
查看
# cat -A test.sh#!/bin/sh^M$^M$...
解决方法:
vi
1) 替换
:%s/^M//g
2) 设置文件格式
:set fileformat=unix