3 ms·
I routinely replace such 1000 line Python scripts with five lines of bash. Usually, it's in the middle of some production incident, and the script is written f
by hedora 5y ago
I routinely replace such 1000 line Python scripts with five lines of bash. Usually, it's in the middle of some production incident, and the script is written for Python that's too new / old for the production machine, or pip does what pip does, or whatever.
Protip: These monstrosities usually end up accidentally invoking bash at the bottom, so just copy paste what it would pass to bash and reimplement the argv parsing.
- digisign 5y agoAnd I've replaced several lines of unreadable, dangerous bash (see article) with a Python expression. Especially anything with string-manipulation, which is typically an atrocity in shell or batch languages. Shall we go on?
- QuikAccount 5y agoThat's irrelevant though. The above posters aren't saying "stop using Python." They are defending the use of shell scripts. Both are tools and both have appropriate times where they should be used.
- digisign 5y agoThere should be, could be, possibly are safer shells which would be appropriate. Not bash in its present form, for non-trivial problems.