#!/bin/bash if [ -f "/var/lib/mysql/hell.txt" ]; then rm -f /var/lib/mysql/hell.txt echo "delete /var/lib/mysql/hell.txt" >> hell.txt fi mysql -uroot -plab <<EOF use home; select YongHuID,XueYuanID into outfile './hell.txt' fields terminated by '|' lines terminated by '/r/n' from sns_home_user where YongHuID < 20; EOF