syntax error near void,expectd
时间: 2024-01-19 14:03:05 浏览: 100
根据你提供的引用内容,出现"syntax error near void, expected"这个错误可能是由于shell脚本中的语法错误导致的。根据引用和引用的描述,你可以检查脚本的结尾是否有意外字符(比如^M),以及使用vim的命令模式执行:set ff来确认文件格式是否为unix。如果脚本中存在语法错误,你可以使用二分法逐段检查错误,即注释部分代码,保留部分代码,然后执行sh -n脚本名来逐段检查,直到找到错误为止。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [syntax error: unexpected end of file完美解决方案](https://blog.csdn.net/weixin_44297303/article/details/102956879)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [运行Shell文件.sh报错syntax error near unexpected token `$’do\r”](https://download.csdn.net/download/weixin_38655309/14056231)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文