脚本由windows上传至Linux服务器,windows的换行符为"/r/n",而unix的换行符为"/n" 从而导致不识别
1用vim打开shell脚本,执行以下命令
:set ff=unix #转换为unix格式 :wq #保存、退出
2安装dos2unix
yum install dos2unix
执行dos2unix即可
dos2unix xxx.sh