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

Programmer Humor

21086 readers
1574 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
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Gobbel2000@programming.dev 12 points 3 days ago (5 children)

So true. Every time I have to look up how to write a bash for loop. Where does the semicolon go? Where is the newline? Is it terminated with done? Or with end? The worst part with bash is that when you do it wrong, most of the time there is no error but something completely wrong happens.

[โ€“] qjkxbmwvz@startrek.website 2 points 3 days ago* (last edited 3 days ago)

I can only remember this because I initially didn't learn about xargs


so any time I need to loop over something I tend to use for var in $(cmd) instead of cmd | xargs. It's more verbose but somewhat more flexible IMHO.

So I run loops a lot on the command line, not just in shell scripts.

load more comments (4 replies)