6 ms·
This is cool but why wouldn't you just do all this in bash?
by kramden 12y ago
This is cool but why wouldn't you just do all this in bash?
- adamnemecek 12y agoBecause I've noticed that my general happiness in life is inversely proportional to the time I spend writing bash.
- andrewchambers 12y agoPython works better on windows than bash does. This is for less technical people who may not want to install and maintain cygwin.
- lmm 12y agoBash has more "gotchas" to remember, and tends to be less readable.
- scrollaway 12y agoAre you really asking why one wouldn't "read PDF and word documents", "parse CSV and json files" or "manipulate images" in bash?
- collyw 12y agoBash is great for really simple things, like renaming a load of files in a loop but the bigger the scrip gets the more I would move towards Python. (i.e. more than one nested loop). Plus somethings are horrendous to remember the syntax for, like capturing a regular expression group. (My personal choice would probably be Perl for many of the tasks, though I would point beginners to Python for its readability).
- panglott 12y agoBecause if you're going to learn a programming language to automate the boring stuff, Python will be easier and take you farther.
- AlSweigart 12y agoYou... probably aren't the book's intended audience. :) But seriously, Python makes easy things easy. In bash, just to extract a substring you need to do something like echo someletters_12345_moreleters.ext | cut -d'_' -f 2 That's not very beginner-friendly.