在ubunu下裝tomcat的時候湃望,剛裝好然后運行./startup.sh準備打開tomcat的時候就報了這個錯誤:
zsh: ./startup.sh: bad interpreter: /bin/sh^M: no such file or directory
原因是由于不同系統(tǒng)編碼格式引起的筑辨。
解決方法:
1)在windows下轉換: 利用一些編輯器如UltraEdit或EditPlus等工具先將腳本編碼轉換,再放到Linux中執(zhí)行藏姐。轉換方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。
2)在Linux中轉換:
主要是修改文件格式熄云。
- 先進入文件: vim startup.sh
- 查看文件格式 :set ff 或 :set fileformat
可以看到如下信息 fileformat=dos 或 fileformat=unix - 修改文件格式 :set ff=unix 或 :set fileformat=unix