this post was submitted on 05 Feb 2025
76 points (98.7% liked)
Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ
56352 readers
552 users here now
⚓ Dedicated to the discussion of digital piracy, including ethical problems and legal advancements.
Rules • Full Version
1. Posts must be related to the discussion of digital piracy
2. Don't request invites, trade, sell, or self-promote
3. Don't request or link to specific pirated titles, including DMs
4. Don't submit low-quality posts, be entitled, or harass others
Loot, Pillage, & Plunder
📜 c/Piracy Wiki (Community Edition):
🏴☠️ Other communities
Torrenting:
- !seedboxes@lemmy.dbzer0.com
- !trackers@lemmy.dbzer0.com
- !qbittorrent@lemmy.dbzer0.com
- !libretorrent@lemmy.dbzer0.com
Gaming:
- !steamdeckpirates@lemmy.dbzer0.com
- !newyuzupiracy@lemmy.dbzer0.com
- !switchpirates@lemmy.dbzer0.com
- !3dspiracy@lemmy.dbzer0.com
- !retropirates@lemmy.dbzer0.com
💰 Please help cover server costs.
Ko-fi | Liberapay |
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm with this... Bash runs in nearly anything without any real good chance of version conflicts.
Why complicate things needlessly?
That's profoundly untrue. Scripting in bash is an indescribably painful experience.
You have absolutely no idea what version of a binary the user will be running so you're limited to using only options that have been well established.
I've never worked with python but I understand it has at least got some semblance of package management providing assurance that methods you're calling exist, and I imagine it has some standardised mechanism for handling errors unlike bash.
A simple example is making a GET request to an API and deserializing a JSON response if its successful, handling a timeout if the server can't be reached or handling the HTTP status code if it's not a 200 response.
JS, python, Rust, C#, Java etc will all handle that simple scenario with zero effort but in bash it's a nightmare.
So, you don't know Python at all AND you don't know Bash, but you feel compelled to talk about how one is so much better than the other?
Python has a lot of compatibility problems, you have to roll the env system and do requirements, and if your distro doesn't have those packages available, you can't run the script. Then you can't always run python 2 code in python 3.
Bash has error handling and try/catch.
Cross platfoming a shell script to run in ba, bash in linux, wsl and mac is fairly straight forward. Worst case, if you don't have a specific flavor of bash installed, you can always install it. You rely on the posix compliance of the OS binaries to get the job done.
I have plenty of experience with Bash, hence why I was eager to question the implication that bash was less complicated than other solutions.
You're correct that I don't know python, but I do have plenty of familiarity with PHP, JS, C#, and Rust. From my experience with those languages I guessed that python probably has similar libraries for making API calls.
Thanks for providing the actual examples. Looking at them I'm curious if you still think I'm wrong?
In my opinion the bash is much more difficult to understand than the python and therefore it's more likely for bugs to creep in. For example I think
curl_exit_code=$?
should be called immediately after the curl command as the way it's presently written isn't it capturing the exit code of the tail command?You've explicitly called
--connect-timeout
and--max-time
. imo it only comes from experience that you need to add these options. I had a script that had been funcitoning without issue for months then suddenly started to hang and it was a while before I figured out that the defaults forcurl
had no timeout so it didn't gracefully fail like I would expect.These are the kind of traps that I fall into all the time with bash and it's painful to debug.
I didn't say it wasn't painful, merely convenient for me.
I'm fine sticking with well established. Why would I need package management with a shell script? Bash has as many ways of handling errors as I give it. All this you mention are using functionality I can address in other ways but again, I never claimed it solved everything. I only prefer it due to knowing that if I solved the problem in bash, it stays solved for me.
Show us on the doll where the shell script touched you...
Everywhere.
I believed bash would be enjoyable, I believed we'd have fun. But all it ever gave was pain. I was young and naive.
Hah! Indeed.
I feel it's the known pain at least. I've had python and perl pain as well, and it's not as comforting a pain to me.
Hello Darkness, my old friend... I've come to script with you again...
POSIX and shell functions can get us very far indeed. At least, not everthing's an object in Bash. :P