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
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
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。