执行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 151 168 187 199 218 230 10079 10239 32478"
array=($county)
length=${#array[@]} for((i=0;i<$length;i++))
do
$HIVE_HOME/bin/hive -e "select * from county_area_category where county_id=${array[$i]}" >> /home/deploy/ouyangyewei/category_area/data/${array[$i]}_county_area_category.txt;
done
done-bash-3.2$ sh test.sh
: command not found
: command not found
'est.sh: line 7: syntax error near unexpected token `
'est.sh: line 7: `for((i=0;i<$length;i++))
-bash-3.2$ cat -v test.sh
#!/usr/bin/env bash^M
^M
county="3 4 5 6 7 8 9 10 11 12 16 29 39 44 53 62 72 84 97 115 128 151 168 187 199 218 230 10079 10239 32478"^M
array=($county)^M
length=${#array[@]}^M
^M
for((i=0;i<$length;i++))^M
do^M
$HIVE_HOME/bin/hive -e "select * from county_area_category where county_id=${array[$i]}" >> /home/deploy/ouyangyewei/category_area/data/${array[$i]}_county_area_category.txt;^M
?OO-bash-3.sed 's/\r//' test.sh > county_area_category.sh
执行shell脚本提示“syntax error near unexpected token for((i=0;i<$length;i++))”的更多相关文章
- Shell脚本报错--syntax error near unexpected token for((i=0;i<$length;i++))
现象: shell脚本使用Nodepad++进行本地编辑,在编辑后上传到linux机器进行执行时提示“syntax error near unexpected token for((i=0;i< ...
- linux后台执行./run.py提示python syntax error near unexpected token `('
python脚本中的#!/usr/bin/python 估计有不少人注意过一些python脚本开头有这么行东东: #!/usr/bin/python 它是用来干嘛的?貌似没有它对脚本功能也没啥 ...
- 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 `”
今天写了个shell脚本,在自己机器上运行正常,给同事,运行报错syntax error near unexpected token `,左看右看shell脚本没有问题,没有办法google搜索,发现 ...
- 写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资料时,按照教材,却出现如下错误,不能运行 如下,简单的脚本: #!/bin/bash cat |while read line do echo $line done < ...
- Linux中syntax error near unexpected token 错误提示解决方法
Linux中syntax error near unexpected token ... 错误提示有一般有两种原因: 1)window和Linux下换行符不一致导致 window下的换行和Linux下 ...
- 解决执行脚本报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 ...
- syntax error near unexpected token `then'问题的解决
#!/bin/bash #if program test echo 'a:' read a if [ "$a" = "English" ];then ...
随机推荐
- MyEclipse2014不支持jre1.8吗
myeclipse 2015才支持了java 8 也可以用Eclipse Kepler加插件的形式来支持java 8
- python urllib和urllib2 区别
python有一个基础的库叫httplib.httplib实现了HTTP和HTTPS的客户端协议,一般不直接使用,在python更高层的封装模块中(urllib,urllib2)使用了它的http实现 ...
- ALEXANDER WANG 北京旗舰店开业活动
ALEXANDER WANG 北京旗舰店开业活动-搜狐女人 ALEXANDER WANG 北京旗舰店开业活动
- iOS学习之NSAttributedString(富文本)
NSAttributedString 叫做富文本,是一种带有属性的字符串,通过它可以轻松的在一个字符串中表现出多种字体.字号.字体大小等各不相同的风格,还可以对段落进行格式化,一般都是对可变富文本(N ...
- Card Game Cheater(贪心+二分匹配)
Card Game Cheater Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...
- 仿知乎安卓client滑动删除撤销ListView
标签(空格分隔): Android 新版的知乎安卓client有一个有趣的功能,就是在一个item里.向右滑动时整个item会越来越透明,滑动到一半时,整个item就不见了.放开手指就是删除.删除后还 ...
- ListView.MultiChoiceModeListener
参考:http://www.cnblogs.com/a284628487/p/3460400.html和http://blog.csdn.net/mayingcai1987/article/detai ...
- .net 弹窗方式
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请输入 ...
- CentOS6.5实现rsync+inotify实时同步
参考博文: 参考1:CentOS6.5实现rsync+inotify实时同步 参考2:inotify-tools+rsync实时同步文件安装和配置 CentOS 6.3下rsync服务器的安装与配置 ...
- 缩略图类库--ThumbLib使用简介
//加载类库文件 require_once 'path/to/ThumbLib.inc.php'; //实例化类库,传入你要处理的图片的地址可以是网络地址,也可以是本地地址 $thumb = PhpT ...