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