执行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 ...
随机推荐
- 怎样用Eclipse正确导入开源库AndroidStaggeredGrid
今天带给大家的是怎样正确导入开源库AndroidStaggeredGrid的代码,大家在使用github上的开源控件时,多多少少都遇到过像AndroidStaggeredGrid这样的project结 ...
- Xcode使用source control 时提示the server certificate failed to verify 的解决办法
wusipingdeMacBook-Pro:~ railgun$ wusipingdeMacBook-Pro:~ railgun$ svn ls https://13.13.13.134:8443/s ...
- E - Phone List(字典序,string类型使用)
Description Given a list of phone numbers, determine if it is consistent in the sense that no number ...
- [Swust OJ 746]--点在线上(线段树解法及巧解)
题目链接:http://acm.swust.edu.cn/problem/746/ Time limit(ms): 1000 Memory limit(kb): 65535 fate是一个数学大牛 ...
- 【centos6 , 6】linux 查看帮助文档:
1. 使用 命令 -h 或 命令 --help , 例: ls -h 2. man命令 : man 命令 例:man ls 3.info命令: ...
- oracle常见问题
1.无效的月份,一个可能是字符集的问题, alter session set nls_language=american alter session set nls_language='SIMPLIF ...
- listview,fragment结合起来
这是csdn上的以个demo,很适合初学者.来源:http://download.csdn.net/detail/endlife99/7274419,侵删. MainActiviy: package ...
- OpenBlas编译方法(体验msys下使用MingW)
OpenBlas是一个优化的Blas库,基于GotoBlas21.13 BSD版,安装步骤如下: Windows下安装: 1. 在SourgeForge下载最新的OpenBlas库:http://so ...
- 基于visual Studio2013解决算法导论之043单源最短路径dijstra矩阵
题目 单源最短路径dijstra矩阵 解决代码及点评 // 26单源最短路径dijstra矩阵.cpp : 定义控制台应用程序的入口点. // #include <iostream> ...
- 位操作 写读同步(无线) (语音1760 1700) ( 无线24l01)
************************************************************************** * 函数原型: unsigned char ISD ...