摘自: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。