#!/bin/bash MYSQL="mysql -h10.10.10.10 -P8036 -uusername -ppassword --default-character-set=utf8 -A -N" sql="select * from atable.user where user_id=123 and (name='name' or name='name')" result="$($MYSQL -e "$sql")" while [[ -n "$result" ]]; do echo $result date sleep 60 result="$($MYSQL -e "$sql")" done date