01-05-2015, 08:12 PM
#!/bin/bash
#
host=127.0.0.1
user=root
pass=
newproject_db=newproject_db
item=123
amount=12
select=`mysql -D $newproject_db -h $host --user=$user --password=$pass --skip-column-names -e "SELECT a_index from t_characters where a_enable = 1 ;"`
for char in ${select[@]}
do
setitem=`mysql -D $newproject_db -h $host --user=$user --password=$pass --skip-column-names -e "INSERT into t_auto_give (a_char_index, a_item_index, a_item_count) VALUES ($char, $item, $amount); "`
done
it's a shell. you must create a .sh file, give right to execute with centos cmd. Don't forget to edit amount, item,pass,user and newproject_db

