执行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 ...
随机推荐
- BZOJ 1610: [Usaco2008 Feb]Line连线游戏
1610: [Usaco2008 Feb]Line连线游戏 Description Farmer John最近发明了一个游戏,来考验自命不凡的贝茜.游戏开始的时 候,FJ会给贝茜一块画着N (2 &l ...
- VS2010/MFC对话框三:创建对话框类和添加控件变量
创建对话框类和添加控件变量 前两讲中讲解了如何创建对话框资源.创建好对话框资源后要做的就是生成对话框类了.生成对话框类主要包括新建对话框类.添加控件变量和控件的消息处理函数等. 例程Addition是 ...
- hibernate+spring的整合思路加实例(配图解)
首先框架整合我感觉最难的是jar包的引入.因为不同框架的jar容易产生冲突.如果能排除这个因素我想说整合框架还是相对比较容易的. 我整合的框架的一个思想就是:各司其职.因为每个框架处理的事务或者是层次 ...
- Swift编程语言学习2.1——基础运营商(在)
操作员正在检查,更改.归并值特殊符号或短语.例如,加+这两个数字相加(例如let i = 1 + 2). 算如更复杂的逻辑和操作的实施&&(例如if enteredDoorCode & ...
- mul16
设计思想:乘法运算本身就可以看做是一个移位相加的过程 1 1 0 1 0 = 26* 1 0 1 1 1 = 23 ...
- Week11(11月21日)
Part I:提问 =========================== 1.如何编辑更新一条记录? Part II:案例学习 =========================== MusicSt ...
- Main方法的执行过程(转)
要运行一个 main 方法 , 首先要知道 main 方法所在的 Class, 在命令行中指定这个 Class 名 Class Lava{ Private int speed = 4; Void fl ...
- assert使用
assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行,原型定义: #include <assert.h> void assert( i ...
- CF(435D - Special Grid)dp
题目链接:http://codeforces.com/problemset/problem/435/D 题意:求三角形个数,三个点必须的白点上,而且三条边必须是横线,竖线或对角线,三条边上不同意出现黑 ...
- Hadoop之——又一次格式化hdfs系统的方法
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/46352939 又一次格式化hdfs系统的方法: (1)查看hdfs-ste.xml ...