파일에 쓰기

2022. 7. 28. 19:50MySQL/etc

반응형

#!/bin/sh

today=`date +%Y%m%d`

before=~date +%Y%m%d -d "-1 year"`

connect='/mysql/local/mysql/bin/mysql -uroot -p123456 DBNAME -S /tmp/mysql.sock -N '

$connect -e "select * from dept where reg_date > ${before} " > /data/dept_${today}.txt

 

반응형