Linux下Python腳本與Shell腳本的使用區別

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

 

自己感悟:

  1. Shell處理簡單任務,10分鐘內快速開發(必須會,畢竟還要操作服務器)。
  2. 過於複雜建議Python。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章