this post was submitted on 05 Mar 2025
1650 points (99.0% liked)

Programmer Humor

21876 readers
622 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 2 years ago
MODERATORS
 
(page 4) 38 comments
sorted by: hot top controversial new old
[–] [email protected] 28 points 2 weeks ago (7 children)

There's always the old piece of wisdom from the Unix jungle: "If you write a complex shellscript, sooner or later you'll wish you wrote it in a real programming language."

I wrote a huge PowerShell script over the past few years. I was like "Ooh, guess this is a resume item if anyone asks me if I know PowerShell." ...around the beginning of the year I rewrote the bloody thing in Python and I have zero regrets. It's no longer a Big Mush of Stuff That Does a Thing. It's got object orientation now. Design patterns. Things in independent units. Shit like that.

load more comments (7 replies)
[–] [email protected] 10 points 2 weeks ago

Any no-SQL syntax for interacting with databases.

[–] [email protected] 10 points 2 weeks ago

Me with powershell. I'll write a pretty complex script, not write powershell for 3 months, come back and have to completely relearn it.

[–] [email protected] 12 points 2 weeks ago (2 children)

This. But Pandas and Numpy.

Pandas and Numpy and Bash.

[–] [email protected] 6 points 2 weeks ago

.loc and .iloc queries are a fun syntax adventure every time

load more comments (1 replies)
[–] [email protected] 4 points 2 weeks ago

Incredibly true for me these days. But don't fret, shellcheck and tldp.org is all you need. And maybe that one stackoverflow answer about how to get the running script's directory

[–] [email protected] 8 points 2 weeks ago (3 children)

I mastered and forgot almost entirely RegEx several times now

[–] [email protected] 3 points 2 weeks ago (2 children)

eh I had an entire career based on regex and i still used rubular on the daily once someone made it. there's too many corner cases for a biological entity!

load more comments (2 replies)
load more comments (2 replies)
[–] [email protected] 3 points 2 weeks ago

VLOOKUP. Every time. Also Catan Cities and Knights.

[–] [email protected] 3 points 2 weeks ago (2 children)

This is why I finally switched to nushell.

load more comments (2 replies)
[–] [email protected] 25 points 2 weeks ago (2 children)

Today I tried to write bash (I think)

I grabbed a bunch of commands, slapped a bunch of "&&" to string them together and saved them to a .sh file.

It didn't work as expected and I did not, at all, look at any documentation during the process. (This is obviously on me, I'll try harder next time)

[–] [email protected] 7 points 2 weeks ago

I try to remember to use man when learning a new command/program. And I almost always half-ass it and press the search button immediately to find whatever flag i need.

load more comments (1 replies)
[–] [email protected] 113 points 2 weeks ago* (last edited 2 weeks ago) (21 children)

Regex

Edit: to everyone who responded, I use regex infrequently enough that the knowledge never really crystalizes. By the time I need it for this one thing again, I haven't touched it in like a year.

[–] [email protected] 31 points 2 weeks ago (1 children)

Most of regex is pretty basic and easy to learn, it's the look ahead and look behind that are the killers imo

load more comments (1 replies)
[–] [email protected] 39 points 2 weeks ago

You get used to it, I don't even see the code—I just see: group... pattern... read-ahead...

[–] [email protected] 7 points 2 weeks ago
load more comments (18 replies)
[–] [email protected] 8 points 2 weeks ago (1 children)

Bash substitution is regex-level wizardry.

[–] [email protected] 7 points 2 weeks ago (3 children)

Slapping a $ before an environment variable name is "wizardry?"

[–] [email protected] 5 points 2 weeks ago (2 children)

Not quite that, but more the ${variable##.*} sort of thing.

load more comments (2 replies)
[–] [email protected] 4 points 2 weeks ago (1 children)

Nope, the whole ${variable/regex/replacement} syntax

load more comments (1 replies)
[–] [email protected] 3 points 2 weeks ago

I feel same with regex....

[–] [email protected] 46 points 2 weeks ago (4 children)

I don't normally say this, but the AI tools I've used to help me write bash were pretty much spot on.

[–] [email protected] 17 points 2 weeks ago* (last edited 2 weeks ago)

Yeah, an LLM can quickly parrot some basic boilerplate that's showed up in its training data a hundred times.

[–] [email protected] 6 points 2 weeks ago

For building a quick template that I can tweak to my needs, it works really well. I just don’t find it to be an intuitive scripting language.

[–] [email protected] 20 points 2 weeks ago (1 children)

Yes, with respect to the grey bearded uncles and aunties; as someone who never "learned" bash, in 2025 I'm letting a LLM do the bashing for me.

[–] [email protected] 40 points 2 weeks ago (4 children)

Until the magic incantations you don't bother to understand don't actually do what you think they're doing.

[–] [email protected] 2 points 2 weeks ago

Yes, I have never wrote a piece of code that didn't do what I thought it would before LLMs, no sir.

[–] [email protected] 10 points 2 weeks ago* (last edited 2 weeks ago)

In fairness, this also happens to me when I write the bash script myself 😂

[–] [email protected] 14 points 2 weeks ago (1 children)

I wonder if there's a chance of getting rm -rf /* or zip bombs. Those are definitely in the training data at least.

load more comments (1 replies)
[–] [email protected] 40 points 2 weeks ago (1 children)

Sounds like a problem for future me. That guy hates me lol

[–] [email protected] 6 points 2 weeks ago

Yeah fuck that guy

load more comments (1 replies)
[–] [email protected] 54 points 2 weeks ago (4 children)

Clearly you don't write enough bash scripts.

[–] [email protected] 5 points 2 weeks ago (1 children)
load more comments (1 replies)
[–] [email protected] 17 points 2 weeks ago (2 children)

Or scripts for basically any other variant of the Bourne shell. They are, for the most part, very cross compatible.

[–] [email protected] 2 points 2 weeks ago (2 children)

I wrote a script to do backups on a ESXi it uses Busybox's ASH, one thing I learned after spending hours debugging my scripts was that ASH does not support arrays so you have to do everything with temporary files.

load more comments (2 replies)
[–] [email protected] 10 points 2 weeks ago

That's the only reason I've ever done much of anything in shell script. As a network administrator I've worked many network appliances running on some flavor of Unix and the one language I can count on to be always available is bash. It has been well worth knowing for just that reason.

load more comments (2 replies)
load more comments
view more: ‹ prev next ›