今天挖掘到两个趁手的语句
via: Python-cn
很帅。
1. 和朋友共享局域网内的文件:
python -mSimpleHTTPServer
记得以前还煞费苦心想自己用SocketServer写一个…完全没有必要.
2. 快速发送邮件以及附件
稍微配置一下mutt,然后写一个小脚本叫sendfile,内容如下
#!/bin/bash
if [ $# -lt 2 ]
then
echo "usage:"
echo " $0 [Email Addr] [Content] "
exit
fi
files=""
if [ $# -gt 2 ]
then
count=0
for param in $@
do
if [ $count -ge 2 ]
then
files="$files -a $param"
fi
count=$[ $count + 1 ]
done
fi
echo "$2" | mutt -s "Hi, Here is a MSG from Shellex
" $files $1
这样我只需要打一个命令就OK了。
~/sendfile target@xx.com Hi appendix
这样,主题为”Hi, Here is a MSG from Shellex
”,内容为”Hi”,附件为appendix的邮件就发到target@xx.com去咯~
Leave a Reply