作为系统管理员教程要写脚本生成报告,并将自动将邮件放到指定的人。然而收到的邮件经常有乱码(中文)。下面是解决方法:
例如cat test.sh:
#!/bin/bash
exportLANG=UTF-8
/usr/local/mysql/bin/mysql-uroot-ppassword-e“select*fromname”>/tmp/test$(date+%m%d).txt(test.txt有中文)
/usr/local/bin/iconv-fUTF-8-tGB2312/tmp/”test$(date+%m%d).txt”|/bin/mail-s“test[$(date-d"1dayago"+%D)]”279262446@qq.com
猜你喜欢