this post was submitted on 11 Aug 2023
47 points (94.3% liked)
Linux
48332 readers
552 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why not use Perl or python for scripting tasks? Bash script is terrible imo.
I mean, I guess technically Perl could do but it wont earn you any favors from your coworkers.
I do use Python for higher level stuff but I don't see a point to go Python when you're just gonna call 20 subprocess anyway to do like apt update apt dist-upgrade apt install wget this untar this rsync this. Especially when you can't even assume you're going to have Python to provision the box.
That's why I included Perl, it is always there. Just don't code as if you were in the nineties and Perl is a perfectly legitimate language, even more so for shell tasks. Bad and good doesn't depend so much on the language but the coder.
IMO there's also a component where a good coder will pick the best suited language for the task, but will also pick something that the rest of their (potentially less skilled, junior or even intern) team won't be scared away by.
If you're mostly just running a few commands and writing to a bunch of files, bash is great and does that in almost no code and remains quite readable. Like, a backup script for a database is essentially a bash one-liner. I'm sure it's also easy in a Perl script, but just seeing a .pl file can scare some admins whereas they know what to expect if they see a .sh.
Then there's also a component of, what does the company uses. If the company runs Ruby apps, then I'd write tooling in Ruby. If the company runs PHP apps, some of the tooling will be written in PHP.
It's very circumstantial in the end. I'll definitely whip up some Perl if it's advantageous, but really most of the time it's just wrapping an rsync or whatever, and at work it's usually just some glue or bootstrapping something like Puppet or Ansible. Not a fan of those personally but it's a safe bet for my role and industry.
On the personal side, I tend to turn to what's my favorite language at the moment, so lately I've been practicing my Rust.