针对您遇到的错误信息 "syntax error: 'fi' unexpected (expecting 'then')",这通常表明在您的shell脚本中存在if语句的语法问题。以下是一些分析和建议,帮助您解决这个问题: 1. 检查if语句的基本结构 确保每个if语句都遵循了正确的语法结构。一个基本的if语句应该看起来像这样: bash if [ condition ]; then #...
从网上copy了一个linux下显示实时网速的脚本,将其copy到windows下的文件并保存,在linux虚拟机下执行脚本,报错Syntax Error "elif" unexpected (expecting then),检查后确认语法没有问题,所以可能是文件编码格式的问题,在命令行执行以下代码将文件转换为Unix格式即可 sed-i's/\r//' filename 附上显示实时网速的脚本...
shell命令在windows下编辑过后出现Syntax error: end of file unexpected (expecting "then") 提示错误 这是因为我在windows下些的脚本,windows和linux的回车换行时不一样的字符,所以脚本在解释时会出现问题。 在windows里,换行用的两个符号,回车换\r行符号\n,在linux下只需一个符号\n就可以了. 1 sed-i's/\...
1、造成该情况的原因: windows下写的脚本,windows和linux的回车换行时不一样的字符,所以脚本在解释时会出现问题。 在windows里,换行用的两个符号,回车换\r行符号\n,在linux下只需一个符号\n就可以了. 2、解决办法: 在vim下,文件结尾 输入 :set fileformat=unix修改ubuntu 和linux服务器、 dos等非图形界面冲...
= 2 Everything is Ok Folders: 2 Files: 74 Size: 281779432 Compressed: 71884166 Fixing SecretKey repack.sh: 72: read: Illegal option -d SecretKey replaced Fixing Title repack.sh: 80: read: Illegal option -d Title Fixed repack.sh: 95: Syntax error: "(" unexpected (expecting "then") ...
本文记录 Syntax error: end of file unexpected (expecting “then”) 错误解决方案。 问题原因 出现问题的原因是.sh文件是dos格式文件,但是linux的shell需要unix格式的文件 解决方案 转换文件格式 代码语言:javascript 代码运行次数:0 复制Cloud Studio 代码运行 $ sudo apt-get install dos2unix $ dos2unix ...
Linux提⽰Syntaxerror:endoffileunexpected(expect。。。shell命令在windows下编辑过后出现Syntax error: end of file unexpected (expecting "then") 提⽰错误 这是因为我在windows下些的脚本,windows和linux的回车换⾏时不⼀样的字符,所以脚本在解释时会出现问题。在windows⾥,换⾏⽤的两个符号,回车换...
ssh报错: -ash: /etc/profile.d/30-sysinfo.sh: line 25: syntax error: unexpected "(" (expecting "then") 关于固件 型号: Xiaomi Mi Router AX3000T 平台: mediatek/filogic 版本: 分支: 23.05-SNAPSHOT 内核: 5.15.148 生成日期: 2024-02-21 04:58:03 说明: 后台: 10.0.
if [ -z $pid ] ; then echo "there isn't this process!" else echo $pid fi 如法应该是ok的,但总是报错: Syntax error: end of file unexpected (expecting "then") 上网查了下 大概是因为我在windows下些的脚本,windows和linux的回车换行时不一样的字符,所以脚本在解释时会出现问题。
root@ApFree:/usr/sbin#./conntrack_num_graph.sh./conntrack_num_graph.sh: line9: syntax error: unexpected"then"(expecting"}") root@ApFree:/usr/sbin# 我就纳闷了,这个脚本几天前是能正常执行的,今天执行怎么会出错,why? cat脚本一看如下: