每次写python文件都要 #!/usr/bin/env python烦不烦啊,想起公司那个rhts-create就模仿写了一个,很简单,考虑的东西似乎没那么简单~
#!/bin/sh
if test $# -eq 0
then
file="test.py"
else
file="$1"
fi
if test -f "$file"
then
echo "$file exist,rename to $file.$$"
file="$file.$$"
fi
(touch $file && chmod +x $file ) || exit 1
echo "#!/usr/bin/env python" >> $file
echo "#func:" "$file" >>$file
echo "#author: sandflee.fang@gmail.com" >> $file
阅读(1986) | 评论(0) | 转发(0) |