执行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 ...
随机推荐
- 新发现的mbstowcs, mbstowcs_s函数,转换多字节到宽字符
http://en.cppreference.com/w/c/string/multibyte/mbstowcs https://msdn.microsoft.com/fr-fr/library/ey ...
- QT5下获取本机IP地址、计算机名、网络连接名、MAC地址、子网掩码、广播地址
获取主机名称 /* * 名称:get_localmachine_name * 功能:获取本机机器名称 * 参数:no * 返回:QString */ QString CafesClient::get_ ...
- nginx的 CPU参数worker_processes和worker_cpu_affinity使用说明
官方说明: http://wiki.nginx.org/NginxChsHttpMainModule#worker_cpu_affinity http://wiki.nginx.org/NginxCh ...
- Windows Azure 社区新闻综述(#77 版)
欢迎查看最新版本的每周综述,其中包含有关云计算和 Windows Azure 的社区推动新闻.内容和对话.以下是本周的亮点. 文章.视频和博客文章 · 文章: Windows Azure 表存储简 ...
- java.lang.Math类,方法学习笔记
/**java.lang 包中的Math 类提供有常量 * 并包含有用于执行基本数学运算的 * 方法,如初等指数.对数.平方根 * 用于进行更高级的数学运算.由于 * 在Math 类的方法都是静态的, ...
- android linearlayout imageview置顶摆放
在练习android时,想在Linearlayout内放一图片,使其图片置顶,预期效果是这样的: 但xml代码imageview写成这样后, <ImageView android:layout_ ...
- Codeforces 57C Array dp暴力找到规律
主题链接:点击打开链接 的非增量程序首先,计算, 如果不增加的节目数量x, 非减少一些方案是x 答案就是 2*x - n 仅仅需求得x就可以. 能够先写个n3的dp,然后发现规律是 C(n-1, 2* ...
- Java线程(十):CAS
前言 在Java并发包中有这样一个包,java.util.concurrent.atomic,该包是对Java部分数据类型的原子封装,在原有数据类型的基础上,提供了原子性的操作方法,保证了线程安全.以 ...
- POJ 1830 【高斯消元第一题】
首先...使用abs()等数学函数的时候,浮点数用#include<cmath>,其它用#include<cstdlib>. 概念: [矩阵的秩] 在线性代数中,一个矩阵A的列 ...
- wifi密码破解方法总结(含破解软件下载链接)
眼下网上流行有非常多无线password的破解方法,总结起来最有用的还是这两种:第一种是Wirelessnetview+WinAirCrackPack软件组合,这个方法简单方便:另外一种就是大家熟悉的 ...