摘自:https://www.zhihu.com/question/30548640/answer/49161020
可以参看Google code style(https://google-styleguide.googlecode.com/svn/trunk/shell.xml)里一段:
- If you find you need to use arrays for anything more than assignment of ${PIPESTATUS}, you should use Python.
- If you are writing a script that is more than 100 lines long, you should probably be writing it in Python instead. Bear in mind that scripts grow. Rewrite your script in another language early to avoid a time-consuming rewrite at a later date.
- 如果有复杂的的对象,请使用Python;
- 如果写了超过100行的shell脚本,考虑使用Python重写。
自己感悟:
- Shell处理简单任务,10分钟内快速开发(必须会,毕竟还要操作服务器)。
- 过于复杂建议Python。