linux shell 突破
targetDate=$(cat maxdayid);
targartMonth=${targetDate::};
targartYear=${targetDate::};
echo $targartMonth;
date +%Y-%m-%d >>curDate ;
curDate=$(cat curDate);
curMonth=${curDate::};
echo $curMonth; sql='SELECT * FROM t_stock_'
union=" union all "
sql_where=" where dayid>\'$targetDate\'"
#去零前缀 targartMonth
if [ ${targartMonth::} = '' ] ; then
targartMonth=${targartMonth::}
echo $targartMonth
fi #去零前缀 curMonth
if [ ${curMonth::}='' ] ; then
curMonth=${curMonth::}
echo $curMonth
fi rm -f stock_sql
#stock_sql echo "[Global]" >>stock_sql
lsql="" if [ $targartMonth -eq $curMonth ]; then echo select adfdfd from stcok$targartYear$curMonth >>stock_sql
else while [[ $curMonth -ge $targartMonth ]];do echo $targartMonth; if [ $targartMonth -eq $curMonth ]; then
#lsql=$lsql$sql$targartYear$targartMonth
if [ $targartMonth -ge ]; then
lsql=$lsql$sql$targartYear$targartMonth$sql_where
else
lsql=$lsql$sql$[targartYear]$targartMonth$sql_where
fi else
if [ $targartMonth -ge ]; then
lsql=$lsql$sql$targartYear$targartMonth$sql_where$union
else
lsql=$lsql$sql$[targartYear]$targartMonth$sql_where$union
fi fi
echo $lsql
targartMonth=$[targartMonth+]
done;
fi echo $sql
#写入文件
echo '$$sql=' "'$lsql'" >>stock_sql
linux shell 突破的更多相关文章
- linux shell 中的sleep命令
开始还以为是这样的语法: sleep(1), 后面发现是: linux shell 中的sleep命令 分类: LINUX 在有的shell(比如linux中的bash)中sleep还支持睡眠(分,小 ...
- Linux shell脚本编程(三)
Linux shell脚本编程 流程控制: 循环语句:for,while,until while循环: while CONDITION; do 循环体 done 进入条件:当CONDITION为“真” ...
- Linux shell脚本编程(二)
Linux shell脚本编程(二) 练习:求100以内所有偶数之和; 使用至少三种方法实现; 示例1: #!/bin/bash # declare -i sum=0 #声明一个变量求和,初始值为0 ...
- Linux shell脚本编程(一)
Linux shell脚本编程: 守护进程,服务进程:启动?开机时自动启动: 交互式进程:shell应用程序 广义:GUI,CLI GUI: CLI: 词法分析:命令,选项,参数 内建命令: 外部命令 ...
- Linux Shell 流程控制语句
* 本文主要介绍一些Linux Shell 常用的流程控制语句* 1. if 条件语句:if-then/if-elif-fi/if- else-fi if [条件判断逻辑1];then command ...
- Linux Shell 截取字符串
Linux Shell 截取字符串 shell中截取字符串的方法很多 ${var#*/} ${var##*/} ${var%/*} ${var%%/*} ${var:start:len} ${var: ...
- Linux Shell 重定向与管道【转帖】
by 程默 在了解重定向之前,我们先来看看linux 的文件描述符. linux文件描述符:可以理解为linux跟踪打开文件,而分配的一个数字,这个数字有点类似c语言操作文件时候的句柄,通过句柄就可以 ...
- Linux Shell 通配符、元字符、转义符【转帖】
作者:程默 说到shell通配符(wildcard),大家在使用时候会经常用到.下面是一个实例: 1 1 2 3 4 [chengmo@localhost ~/shell]$ ls a.txt ...
- Linux Shell中单引号、双引号、反引号的区别【转载】
linux shell可以识别4种不同类型的引字符号: 单引号字符' 双引号字符" 反斜杠字符\ 反引号字符` 1. 单引号 ( '' )# grep Susan phonebook Sus ...
随机推荐
- c++ primer note
---恢复内容开始--- 1.decltype 2.auto 3.cbegin 4.cend 5.constexpr 6.(*Parray)[10]=&arr; //Parray 指向一个含有 ...
- K-th Number(poj 2104)
题意:静态第K大 #include<cstdio> #include<iostream> #include<cstring> #define N 200010 #d ...
- 标准C程序设计七---06
Linux应用 编程深入 语言编程 标准C程序设计七---经典C11程序设计 以下内容为阅读: <标准C程序设计>(第7版) 作者 ...
- NSArray,NSMutableArray的一些常用方法
不可变数组 ——NSArray 常用的初始化一个数组: NSArray *array1 = [[NSArray alloc] init]; NSArray *array2 = ...
- mysql索引底层的数据结构和算法
1. 为什么要用索引 索引在MySQL中也叫做“键”,是存储引擎用于快速找到记录的一种数据结构.索引对于良好的性能非常关键,尤其是当表中的数据量越来越大时,索引对于性能的影响愈发重要. 索 ...
- HDU - 4630 No Pain No Game (线段树 + 离线处理)
id=45786" style="color:blue; text-decoration:none">HDU - 4630 id=45786" style ...
- [scrapy]Item Loders
Items Items就是结构化数据的模块,相当于字典,比如定义一个{"title":"","author":""},i ...
- SolidEdge如何修改线型和线宽
选中一条直线,然后点击如下所示两个按钮,可以分别修改线型和线宽.
- oracle下session的查询与删除
oracle下session的查询与删除 1.查询当前session SQL> select username,sid,serial# from v$session where username ...
- DASH----Desktop and mobile Architecture for System Hardware----桌面和移动系统硬件架构(DASH)计划
http://baike.baidu.com/subview/813787/11301142.htm http://sites.amd.com/cn/business/it-solutions/man ...