天天看点

一个循环改名的shell

#!/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;";

        #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++));

    readname

    echo "pingguo:" $a

    if [ $a -gt 98186387 ];

    then

    fi

done

本文转自 chengxuyonghu 51CTO博客,原文链接:http://blog.51cto.com/6226001001/1829748,如需转载请自行联系原作者