3 ms·
I'd love to read a good blog post on when to use shell scripts vs Python or other programming languages, which seem far more accessible to me.
by savolai 7y ago
I'd love to read a good blog post on when to use shell scripts vs Python or other programming languages, which seem far more accessible to me.
- smartmic 7y agoI agree, there is not just one true answer to it. For me, I would prefer shell scripts in many bootstrapping processes targeted on system administration. Also as glue language for many GNU tools, shell (then probably bash) is indispensable. With pure shell I can reduce the number of abstraction layers and dependencies. Also POSIX cross-platform compatiblity is a big point, just think of ``./configure`` in software builds.
- peterwwillis 7y agoIf all you need to do is chain together external programs, set environment variables, redirect filehandles, iterate over files, etc with the tiniest bit of logic, and don't want to have to set up an execution environment or download something to do it, and want ultimate Unixy portability, and you want virtually anyone to be able to read and maybe modify it, you want shell. If you need to do a very specific task that involves interpreting/modifying data structures/formats, if you have non-trivial logic, if you need to use a module, if you need to access an operating system primitive which Unix shells don't really expose, if there's no Unix tool that does what you want, or you just need more control/certainty/reliability, you want Python or something else.
- savolai 7y agoThe funny thing though is that the "virtually anyone" part seems to me more likely to happen with python - or with any mainstream programming language - than with what seem to me like deeply arcane shell incantations.
- deleted 7y ago[deleted]