Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

Recently I was looking at python's shutil and subprocess etc... And I started wondering: wouldn't it be ok to use python instead of e.g. bash?

What am I missing?

share|improve this question

marked as duplicate by gnat, Martijn Pieters, thorsten müller, Bart van Ingen Schenau, Kilian Foth Apr 15 '13 at 9:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can replace bash with iPython I believe http://ipython.org/ –  shtuff.it Jan 23 '13 at 7:42
See also Object-oriented shell for *nix –  Gilles Jan 23 '13 at 18:55

1 Answer 1

up vote 8 down vote accepted

Convenience of syntax, mostly.

In python, running a process requires subprocess.call(...); renaming a file shutil.move(), etc. Bash syntax is much more direct for those tasks.

Yes, Python is a great language, but the explicit syntax to execute (for bash) simple tasks is going to get in the way of doing day-to-day work real fast.

share|improve this answer
amoffat.github.com/sh –  Ismail Badawi Jan 9 '13 at 18:50
@isbadawi: exactly; adding a powerful module helps improve the convience levels of course! But if we are looking at just python, then those same tasks are going to be (a lot) more cumbersome. –  Martijn Pieters Jan 9 '13 at 18:53
Looking just at "just python" (which I presume is core language + stdlib to you) is useless IMHO, in that it doesn't match how the language is actually used. –  delnan Jan 9 '13 at 19:02
@Izkata: verbose/cluttered is a relative thing. I find doing almost any type of serious programming in bash to be like getting a root canal without anesthesia. (And I say that having been at a shell prompt since 1980.) Bash still is forking subprocesses just like Python, so it doesn't seem to have any inherent advantage other than 3 decades of inertia. –  Peter Rowell Jan 10 '13 at 6:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.