host=`mysql -u$user -p$pass -D $db -e "select host from user;"` or host=$(mysql -u$user -p$pass -D $db -e "select host from user;")html
将结果用 | grep -v host 筛出来至变量中~不用循环了。。。mysql
参考sql
百度知道~shell
循环取出结果至变量.net