improve the shell scripts
Merge pull request #1251 from syureyi/sendmail

improve the shell scripts