测试用,先来一个简单的,这个是国产神通数据库的,用isql命令:
!/bin/bash if [ $ == "-h" ]
then
echo "USAGE: $0 table_name max_insert_row field_a (field_b ...)"
exit
fi if [ $# -lt ]
then
tbl_name="test_tbl"
field_a=
max_insert=
else
tbl_name=$
max_insert=$
field_a=$
fi id= while test $id -le $max_insert
do
isql -c "insert into $tbl_name values($id,$field_a);"
let id=$id+
let field_a=$field+
done echo "insert bash has completed. total: $id."
如果是mysql 将相应的sql语句替换即可
mysql -uroot -ppassword -e "insert into $tbl_nam values($id,$field_a);"