shell导出mysql部分数据

#!/bin/sh
SYSTEM=`uname -s`
echo "echo"$SYSTEM

if [[ $SYSTEM = "Linux" ]]; then
        echo "SYSTEM Linux"
elif [[ $SYSTEM = "FreeBSD" ]]; then
        echo "SYSTEM FreeBSD"
elif [[ $SYSTEM = "Solaris" ]]; then
        echo "SYSTEM Solaris"
else
        echo "What?"
fi #ifend
    
while read line
do
   echo $line
done <backup
    
mysql -u root<<EOF
use mysql;
select * from user into outfile '/backup/temp.txt';

posted @ 2014-06-10 14:02  灰太郎吃掉懒羊羊  阅读(632)  评论(0编辑  收藏  举报