If you have an utility to access your db, and this utility returns a scalar result, then you can use that to script.
For example, this is with oracle.
Code:# su - oracle /usr/users/oracle> /usr/users/oracle> a=`sqlplus -s '/ as sysdba' << EOF > set feedback off pages 0 > select max(1) from dual; > EOF` /usr/users/oracle> echo $a 1 /usr/users/oracle>
标签:users,script,sh,result,oracle,query,usr From: https://www.cnblogs.com/lbzwd/p/17030351.html