3 ms·
> It takes practice and repetition like with most programming languages To me the issue is why learn a different language for scripting? Python is the obvious
by rr808 4y ago
> It takes practice and repetition like with most programming languages
To me the issue is why learn a different language for scripting? Python is the obvious replacement, but even Java write scripts in, I'm pretty sure any major language can compile and run easily.
- zaphirplane 4y agoThe ergonomics of calling other commands filtering and piping the output is better in sh, till some complexity limit and error tolerance Of course python comes with its own package management and system version clashes
- the_third_wave 4y agoNot to mention a slow startup problem, a pipe of python tools spends some significant time there where (ba)sh is close to instantaneous.
- krageon 4y agoPython is a great language, but not if you want to glue together shell commands. It is very verbose and quite obviously not a first-class citizen. That is what you use bash for.
- chriswarbo 4y agoRunning one command after another is trivial in most languages. The hard part is pipelines, which are inherently concurrent. For example, to pipe one subprocess into another in Python requires spawning off separate threads to shuttle the data around (there are libraries which make this easier, but then your scripts will require a package manager...). Shells are pretty decent at piping and spawning subprocesses. They suck at anything algorithmic, numeric, etc. Thankfully those tasks can usually be handed off to a separate tool (e.g. classic Unix text processing tools, like sed/grep/cut/etc., or more recent data processing tools like jq, mlr, etc.)
- rr888 4y agoRight, I really meant in a proper programming language you'd use high level libraries to do this work, rather than shelling sub processes. You wouldn't need sed/grep/cut.