解决shell脚本“syntax error near unexpected token `fi'”的问题。
执行shell脚本的时候,提示如下错误:
查询资料后发现:
执行:
vi finddir.sh
然后,输入
:set ff
结果是:
解决方案就是,修改为unix:
:set ff=unix
执行保存命令:
:wq
再次执行:
:set ff
最后执行命令。
本文中有一处错误,那就是脚本中的
if [-d "$folder"]; then
改为:
if [ ! -d "$folder" ]; then
亲测好使。
解决shell脚本“syntax error near unexpected token `fi'”的问题。的更多相关文章
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
参考:https://blog.csdn.net/u012453843/article/details/69803244 解决执行脚本报syntax error: unexpected end of ...
- shell出现syntax error near unexpected token `<' 解决方法
最新在看一个shell资料时,按照教材,却出现如下错误,不能运行 如下,简单的脚本: #!/bin/bash cat |while read line do echo $line done < ...
- Error_Unix Shell_syntax error near unexpected token `fi'
2014-06-19 BaoXinjian 1. Issue 调用如下Shell脚本时出现错误syntax error near unexpected token `fi'
- Shell脚本报错--syntax error near unexpected token for((i=0;i<$length;i++))
现象: shell脚本使用Nodepad++进行本地编辑,在编辑后上传到linux机器进行执行时提示“syntax error near unexpected token for((i=0;i< ...
- 执行shell脚本提示“syntax error near unexpected token for((i=0;i<$length;i++))”
sh脚本例如以下: #!/usr/bin/env bash county="3 4 5 6 7 8 9 10 11 12 16 29 39 44 53 62 72 84 97 115 128 ...
- syntax error near unexpected token `do(写的shell脚本出现格式问题)--->1.问题2.展示信息3.解决方案
1问题:Linux和windows下的回车换行符不兼容的问题 [root@node-01 script]# sh start_zk.sh art_zk.sh: line 3: syntax error ...
- 写shell,运行出错:syntax error near unexpected token `$’do\r”
cygwin下面写shell,运行出错:syntax error near unexpected token `$’do\r” 写shell,运行出错:syntax error near unexpe ...
- shell编程报错:“syntax error near unexpected token `”
今天写了个shell脚本,在自己机器上运行正常,给同事,运行报错syntax error near unexpected token `,左看右看shell脚本没有问题,没有办法google搜索,发现 ...
- syntax error near unexpected token `then'问题的解决
#!/bin/bash #if program test echo 'a:' read a if [ "$a" = "English" ];then ...
随机推荐
- 系统软键盘">Android在外接物理键盘时,如何强制调用系统软键盘?
第一次写,写的不好请见谅 物理键盘映射过程: 手机/system/usr/keylayout/*.kl :内核将keyCode映射成有含义的字符串KeycodeLabels.h : framework ...
- unity3d自动寻路教程
U3D的自动寻路插件是不少,但是其实U3D的PRO版本就提供了相当实用的自动寻路组件了,以下教程分别讲解自动寻路的路径选择优先,上楼梯跳下的条件判断等等实用方法,教程分三编,但这个教程没有讲到Navm ...
- unorder_set<typename T> 学习
转自http://blog.csdn.net/mmzsyx/article/details/8240071 散列容器(hash container): 通常比二叉树的存储方式可以提供更高的访问效率.# ...
- 利用github搭建个人网站
1.注册一个github https://github.com/ 2.新建一个仓库 仓库名 用 Owner.github.io 的格式,然后点击创建 3.源码上传至github 安装github桌 ...
- mac 当前位置打开终端
做开发时经常会遇到在当前目录打开终端的情况,一直都是先启动终端,然后再切换到当前目录,今天发现了一个新的方法,虽然不是一步到位,但比以前快多了. 工具/原料 mac系统 苹果电脑 方法/步骤 ...
- iOS开发 NSArray技巧
sh数组快速倒序 NSArray *arr = @[@"first",@"second"]; arr = arr.reverseObjectEnumerator ...
- Android GC 原理探究
导语 想写一篇关于 android GC 的想法来源于追查一个魅族手机图片滑动卡顿问题,由于不断的 GC 导致的丢帧卡顿的问题让我们想了很多方案去解决,所以就打算详细的看看内存分配和 GC 的原理,为 ...
- ubuntu怎样打开命令行终端(5种方法)
内容中包含 base64string 图片造成字符过多,拒绝显示
- MKVToolNix v8.7.0
功能强大的MKV封装格式视频文件制作和编辑工具,支持音轨.字幕的封装,高清发烧友必备工具. 百度云:http://pan.baidu.com/s/1eQWPnxS password:ll64 360 ...
- web前端面试系列 - js中的prototype
js中一切皆为对象,其中函数也是一种对象, 而每个函数都有一个prototype属性,其值也是一个对象. 一.prototype的作用 1. 在多个实例对象之间共享数据和方法. 2. 通过原型链实现继 ...