How to pass mysql query to a variable?
Hi can somene help me how to pass the output of an mysql query to a variable?
for ex.
==========================================================
#!/bin/sh
echo select count(*) from out where bfr_id=1 and status=0' | mysql -uroot
===========================================================
output is
count(*)
47568
i try to do this...
===============================================================
#!/bin/sh
DBS='echo select count(*) from out where bfr_id=1 and status=0' | mysql -uroot
echo $DBS
================================================================
nut nothing happens...what i want is to pass the value of "count(*)" to the variable of DBS and then prints it...
can you please help
thanks a lot...
|