解決shell腳本錯誤$’r’ command not found

從windows上傳了一個腳本到Linux上執行 出現如下錯誤:$'\r': command not found
這是windows與Unix文本編輯的默認格式不同造成的,需要轉成unix格式。

解決方法
[root@localhost ~]# yum install -y Example.sh
[root@localhost ~]# dos2unix Example.sh
dos2unix: converting file Example.sh to Unix format ...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章