一个循环改名的shell
2016-07-25 17:35
447 查看
#!/bin/bash
DB_IP=
DB_USER=
DB_PASSWD=
DB_NAME=
a=98000000
function addsql()
{
ine2=$1
ine3=$2
#sql1="update 表名 set 列明= ${ine2} where ID= ${ine3};";
sql1="update 表名 set SEX=0 where ID= ${ine3};";
echo $sql1
mysql -u $DB_USER -h ${DB_IP} -p${DB_PASSWD} $DB_NAME -e "$sql1"
}
function readname()
{
while read line
do
echo $line
sql1="update 表名 set 列名='${line}' where ID=${a} ;"
#sql1="update 表名 set SEX=0 where ID= $a;";
mysql -u $DB_USER -h ${DB_IP} -p${DB_PASSWD} $DB_NAME -e "$sql1"
#addsql $line $a
a=$(($a+1))
echo "banana:"$a
if [ $a -gt 98186387 ];
then
exit
fi
done < /root/nickname20160616.txt
}
for((t=0;t<=30;t++));
do
readname
echo "pingguo:" $a
if [ $a -gt 98186387 ];
then
exit
fi
done
DB_IP=
DB_USER=
DB_PASSWD=
DB_NAME=
a=98000000
function addsql()
{
ine2=$1
ine3=$2
#sql1="update 表名 set 列明= ${ine2} where ID= ${ine3};";
sql1="update 表名 set SEX=0 where ID= ${ine3};";
echo $sql1
mysql -u $DB_USER -h ${DB_IP} -p${DB_PASSWD} $DB_NAME -e "$sql1"
}
function readname()
{
while read line
do
echo $line
sql1="update 表名 set 列名='${line}' where ID=${a} ;"
#sql1="update 表名 set SEX=0 where ID= $a;";
mysql -u $DB_USER -h ${DB_IP} -p${DB_PASSWD} $DB_NAME -e "$sql1"
#addsql $line $a
a=$(($a+1))
echo "banana:"$a
if [ $a -gt 98186387 ];
then
exit
fi
done < /root/nickname20160616.txt
}
for((t=0;t<=30;t++));
do
readname
echo "pingguo:" $a
if [ $a -gt 98186387 ];
then
exit
fi
done
相关文章推荐
- Xshell远程连接VMware如何修改网卡配置文件
- linux shell中单引号、双引号、反引号、反斜杠的区别
- Linux 下的 shell 编程之 输入输出
- shell/命令行下的光标移动等操作技巧
- 右键git bash here和git gui here失效恢复
- shell--3.运算符
- scp不用密码远程拷贝
- HDU 5730 Shell Necklace(CDQ分治+FFT)
- Linux基础命令之echo(涉及bash命令引用及替换部分内容)
- shell常用文本工具
- scrapy测试xpath
- adb shell settings 控制安卓系统设置
- [shell基础]——I/O重定向
- Linux中的shell
- linux shell之sed
- 阿里云服务器Linux CentOS安装配置(九)shell编译、打包、部署
- bash部分重要特性
- shell调用自定义函数及传参
- shell--2.shell数组
- shell--1.shell 相关及变量