this post was submitted on 05 Mar 2025
1583 points (99.0% liked)
Programmer Humor
21029 readers
1250 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
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
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
Bash substitution is regex-level wizardry.
Slapping a $ before an environment variable name is "wizardry?"
interns be interning
Not quite that, but more the
${variable##.*}
sort of thing.Right, so that's just the string manipulation functions. I already posted a link to the bible for this following a different reply to the same comment to which you replied.
Back then, a pain in the ass. Nowadays, I just let an AI handle that. I used this crap for years and years and still cannot remember, which symbols you need in which order. And why should I remember? I'm not the computer. The computer should know, not me.
Nope, the whole
${variable/regex/replacement}
syntaxAll the string manipulation functions are easy: https://tldp.org/LDP/abs/html/string-manipulation.html
This one is my bookmark
https://tldp.org/LDP/abs/html/parameter-substitution.html
Every time I have to do this I always go here. I can never remember the prefix suffix parts next time I do parameter substitution.