line 10:syntax error: unexpected end of file
在Linux執行如下指令碼的時候:
遇到如下錯誤:
line 10:syntax error: unexpected end of file
多方測試始終不見效果,最終同事陳大師找到了原因,我的指令碼是從Windows上ftp到Linux上的,Linux下的檔案結束符和Windows下的檔案結束符不一樣。在Windows上編輯的指令碼,放在Linux額上執行就會有這種問題。
網上又查了以下,解決方法是使用vim開啟指令碼,執行命令:
set fileformat=unix
儲存退出,再次執行就沒有問題了。當然,也可以在Linux上重新新建一個指令碼。
點選(此處)摺疊或開啟
- #/bin/bash
- echo "You are logged in as `whoami`"
- if [ `whoami` != root ]; then
- echo "Must be logged on as root to run this script."
- fi
line 10:syntax error: unexpected end of file
多方測試始終不見效果,最終同事陳大師找到了原因,我的指令碼是從Windows上ftp到Linux上的,Linux下的檔案結束符和Windows下的檔案結束符不一樣。在Windows上編輯的指令碼,放在Linux額上執行就會有這種問題。
網上又查了以下,解決方法是使用vim開啟指令碼,執行命令:
set fileformat=unix
儲存退出,再次執行就沒有問題了。當然,也可以在Linux上重新新建一個指令碼。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29067253/viewspace-2131547/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Solaris syntax error: unexpected end of fileError
- Solaris awk: syntax error near line 1 awk: bailing out near line 1ErrorAI
- Binary XML file line #2: Error inflatingXMLError
- 執行py檔案 File "<stdin>", line 1 SyntaxError: invalid syntaxError
- Nginx unexpected end of file 配置證書遇到問題,如何解決?Nginx
- pecl PHP Parse error: syntax error, unexpected 'new' (T_NEW) 以及 XML缺失解決辦法PHPErrorXML
- Laravel 8使用 佇列任務出現 「 syntax error, unexpected ')' 」錯誤解決Laravel佇列Error
- PbootCMS 升級後網站打不開,解析錯誤 Parse error: syntax error, unexpected ‘:’, expecting ‘{’怎麼辦boot網站Error
- error unexpected trailing commaErrorAI
- 如何解決"Parse error: syntax error"Error
- 解決:npm install ERR! Unexpected end of JSON inputNPMJSON
- Newline required at end of file but not foundUI
- 【shell 】syntax error in conditional expressionErrorExpress
- Syntax error, unrecognized expression: li[value=]ErrorZedExpress
- npm install “Unexpected end of JSON input while parsing near”問題NPMJSONWhile
- IMP-00009: abnormal end of export fileORMExport
- 帝國CMS提示parse error syntax error的解決方法Error
- Error running ‘Application’Command line is too longErrorAPP
- npm install 出現 npm ERR! Unexpected end of JSON input while parsing near '...ostNPMJSONWhile
- 如何解決"You have an error in your SQL syntax"ErrorSQL
- 【C進階】#error和#line使用分析Error
- 解決 eslint 的 Parsing error: Unexpected token 錯誤EsLintError
- File "/usr/libexec/urlgrabber-ext-down", line 28
- 【故障處理】ORA-3113 "end of file on communication channel"
- springBoot+mvc專案:unexpected error(type=Not Acceptable,stauts=-406)Spring BootMVCError
- ORA-03113: end-of-file on communication channel 解決方法
- 萬能方法解決——You have an error in your SQL syntaxErrorSQL
- python關於Error tokenizing data. C error: Expected 10 fields in line 30, saw 31可能出現的問題PythonError
- ubuntu下pig報錯ERROR 2999: Unexpected internal error. Failed to create DataStorage的解決UbuntuErrorAIAST
- 記錄某次解決`Okhttp java.io.EOFException: \n not found: size=0 content= unexpected endHTTPJavaException
- Android:Unexpected lock protocol found in lock file. Expected 3, found 0.AndroidProtocol
- psql: error: could not connect to server: No such file or directorySQLErrorServer
- Oracle啟動報錯:ORA-03113: end-of-file on communication channelOracle
- fatal error: libmemcached/memcached.h: No such file or directoryErrorIBM
- fatal error: openssl/sha.h: No such file or directoryError
- fatal error: sys/cdefs.h: No such file or directoryError
- 執行遷移檔案報錯: Syntax error or access violation: 1166 ...Error
- 360 Atals:Cause: java.sql.SQLException: Proxy Warning - near “status“: syntax errorJavaSQLExceptionError
- Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using anErrorObjectZed