602
you are viewing a single comment's thread
view the rest of the comments
[-] pulaskiwasright@lemmy.ml 6 points 1 year ago

Things that could have been done in bash is python’s best usecase. And bash sucks for scripting. Why not python?

[-] entropicdrift@lemmy.sdf.org 19 points 1 year ago* (last edited 1 year ago)

There are many cases where bash/shell is better than Python. For one, any time you're just stringing together 2-4 existing shell tools, bash has unbeatable speed since it's all running in C. Plus, you should probably learn the tools anyways to handle CLI stuff on a day-to-day level, so the knowledge is reusable and becomes very intuitive to compose into some crazy one-liner piped chains of commands. If I just want to loop over a set of directories and do a couple chained CLI commands on each directory, this is the way I go.

That said, in cases where you're doing something very custom, any time you're doing something that can't be simply described as a chain of CLI tool transformations, and any time you want to maintain a global state across a complex set of operations outside of a pipeline, I agree that Python is generally a more robust solution with much easier maintainability.

[-] jim_stark@programming.dev 4 points 1 year ago

compose into some crazy one-liner piped chains of commands

Why not something that is completely redesigned from the ground up:

[-] avonarret1@programming.dev 2 points 1 year ago

That looks really elegant. I think I'm gonna give it a try. Thanks a lot for the recommendation!

[-] princess@lemmy.blahaj.zone 9 points 1 year ago

have you ever tried to recreate a simple shell pipeline in Python

[-] pulaskiwasright@lemmy.ml -2 points 1 year ago

If we’re talking about 5 like script, then sure. Just use bash. But python is much better long term, in my experience, for scripts any bigger than that.

this post was submitted on 06 Aug 2023
602 points (97.3% liked)

Programmer Humor

19192 readers
1125 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS