1、判斷數據庫中記錄是否存在
vartmp=`mysql -uroot -p123456 -e "use test;select * from tb_test where test_id=1 "`
echo $vartmp
if [ -z "$vartmp" ];then
echo "no exist"
else
echo "exist"
fi
1、判斷數據庫中記錄是否存在
vartmp=`mysql -uroot -p123456 -e "use test;select * from tb_test where test_id=1 "`
echo $vartmp
if [ -z "$vartmp" ];then
echo "no exist"
else
echo "exist"
fi