标签:style class blog code com 使用
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++))”,布布扣,bubuko.com
运行shell脚本提示“syntax error near unexpected token for((i=0;i<$length;i++))”
标签:style class blog code com 使用
原文地址:http://blog.csdn.net/yeweiouyang/article/details/32101981