Linux執行shell腳本報錯 No such file or directoryer.sh


  報錯原因:

  : No such file or directoryer.sh: line 2: cd: /www/wwwroot/php-main-user

  1. 初始問題總結:

    在正常情況下以.sh文件后綴名結尾的是可以在Linux直接執行的(結果如上)

   2.問題分析:

    (1) Linux執行.sh文件,提示No such file or directory的問題

    (2) window平台下,寫好shell腳本文件,遷移到linux平台,賦過可執行權限,執行該sh文件

    (3) 文件格式兼容問題

  3.測試問題

    (1) vim    .sh文件

    (2) 輸入[plain]

    (3) :set ff

    (4) 回車顯示fileformat=dos,重新設置下文件格式

    (5) :set ff=unix

    (6) 刪除[plain]

    (7) :wq

  4.問題解決

  


免責聲明!

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



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM