how can I write this shell script in python?

When should you write shell scripts and when should you use Python?

  • I am using them somewhat interchangeably for my work.  I am more proficient in bash at this point and trying to figure out how to make the transition to relying more heavily on Python. The downside is that for a given task I have to budget more time in Python because I am still pretty low on the learning curve there. So I am trying to come up with some decision rules.

  • Answer:

    It's not needed "relying more heavily on Python ", why not just use python when it's hard to write with shell scripts . Python is not superior on all sides compared to shell scripts.

Ligon Liu at Quora Visit the source

Was this solution helpful to you?

Other answers

You can write the entire shell script in python. Also the same code will work for all environments like Linux and windows or Mac if written properly ! Once you get acquainted with the python thing, things are hell fast !

Abhishesh Sharma

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.